Package org.apache.sling.testing.mock.sling

# Class MockResourceBundle

java.lang.Object
java.util.ResourceBundle
org.apache.sling.testing.mock.sling.MockResourceBundle

public final class MockResourceBundle extends ResourceBundle
Mock implementation of an i18n `ResourceBundle`. Contains no translations by default and returns the key itself. But you can add your own mappings.

## Nested Class Summary

## Nested classes/interfaces inherited from class java.util.ResourceBundle

`ResourceBundle.Control`

## Field Summary

### Fields inherited from class java.util.ResourceBundle

`parent`

## Constructor Summary

Constructors
Constructor
Description
`MockResourceBundle(String baseName, Locale locale)`

## Method Summary

Modifier and Type
Method
Description
`String`
`getBaseName()`
`Enumeration<String>`
`getKeys()`
`Locale`
`getLocale()`
`protected Object`
`handleGetObject(String key)`
`Set<String>`
`keySet()`
`void`
`put(@NotNull String key, @NotNull String value)`
Add translation.
`void`
`putAll(@NotNull Map<? extends String,? extends String> map)`
Add translations.

### Methods inherited from class java.util.ResourceBundle

`clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getObject, getString, getStringArray, handleKeySet, setParent`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MockResourceBundle

public MockResourceBundle(String baseName, Locale locale)

Parameters:
  `baseName` - Base name
  `locale` - Locale

## Method Details

### getLocale

public Locale getLocale()

Overrides:
  `getLocale` in class `ResourceBundle`

### handleGetObject

protected Object handleGetObject(String key)

Specified by:
  `handleGetObject` in class `ResourceBundle`

### keySet

public Set<String> keySet()

Overrides:
  `keySet` in class `ResourceBundle`

### getKeys

public Enumeration<String> getKeys()

Specified by:
  `getKeys` in class `ResourceBundle`

### getBaseName

public String getBaseName()

Returns:
  Base name

### put

public void put(@NotNull @NotNull String key, @NotNull @NotNull String value)
Add translation.

Parameters:
  `key` - Key
  `value` - Value

### putAll

public void putAll(@NotNull @NotNull Map<? extends String,? extends String> map)
Add translations.

Parameters:
  `map` - Translation map