Package org.apache.sling.testing.resourceresolver

# Class MockValueMap

java.lang.Object
org.apache.sling.api.wrappers.ValueMapDecorator
org.apache.sling.api.wrappers.DeepReadValueMapDecorator
org.apache.sling.api.wrappers.DeepReadModifiableValueMapDecorator
org.apache.sling.testing.resourceresolver.MockValueMap

All Implemented Interfaces:
  `Map<String,Object>`, `org.apache.sling.api.resource.ModifiableValueMap`, `org.apache.sling.api.resource.ValueMap`

public class MockValueMap extends org.apache.sling.api.wrappers.DeepReadModifiableValueMapDecorator implements org.apache.sling.api.resource.ModifiableValueMap
ValueMap for mocked resources to mimick JCR-like behavior.

Implements the following conversions:

- Converts all Date values to Calendar objects internally and vice versa.
- Converts InputStream to byte array and vice versa.

## Nested Class Summary

## Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K extends Object,V extends Object>`

## Field Summary

### Fields inherited from interface org.apache.sling.api.resource.ValueMap

`EMPTY`

## Constructor Summary

Constructors
Constructor
Description
`MockValueMap(org.apache.sling.api.resource.Resource resource)`
`MockValueMap(org.apache.sling.api.resource.Resource resource, Map<String,Object> map)`

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
`<T> T`
`get(String name, Class<T> type)`
`Object`
`put(String key, Object value)`
`void`
`putAll(Map<? extends String,?> map)`
`Object`
`remove(Object key)`

### Methods inherited from class org.apache.sling.api.wrappers.DeepReadValueMapDecorator

`containsKey, get, get`

### Methods inherited from class org.apache.sling.api.wrappers.ValueMapDecorator

`containsValue, entrySet, equals, hashCode, isEmpty, keySet, size, toString, values`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Map

`compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values`

### Methods inherited from interface org.apache.sling.api.resource.ValueMap

`get`

## Constructor Details

### MockValueMap

public MockValueMap(org.apache.sling.api.resource.Resource resource)

### MockValueMap

public MockValueMap(org.apache.sling.api.resource.Resource resource, Map<String,Object> map)

## Method Details

### get

public <T> T get(String name, Class<T> type)

Specified by:
  `get` in interface `org.apache.sling.api.resource.ValueMap`
Overrides:
  `get` in class `org.apache.sling.api.wrappers.DeepReadValueMapDecorator`

### put

public Object put(String key, Object value)

Specified by:
  `put` in interface `Map<String,Object>`
Overrides:
  `put` in class `org.apache.sling.api.wrappers.ValueMapDecorator`

### putAll

public void putAll(Map<? extends String,?> map)

Specified by:
  `putAll` in interface `Map<String,Object>`
Overrides:
  `putAll` in class `org.apache.sling.api.wrappers.ValueMapDecorator`

### remove

public Object remove(Object key)

Specified by:
  `remove` in interface `Map<String,Object>`
Overrides:
  `remove` in class `org.apache.sling.api.wrappers.ValueMapDecorator`

### clear

public void clear()

Specified by:
  `clear` in interface `Map<String,Object>`
Overrides:
  `clear` in class `org.apache.sling.api.wrappers.ValueMapDecorator`