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

# Class MockResourceBundleProvider

java.lang.Object
org.apache.sling.testing.mock.sling.MockResourceBundleProvider

All Implemented Interfaces:
  `org.apache.sling.i18n.ResourceBundleProvider`

public final class MockResourceBundleProvider extends Object implements org.apache.sling.i18n.ResourceBundleProvider
Mock implementation of @link `ResourceBundleProvider` then ensures resolving i18n keys does not lead to exceptions. By default it contains no translations, but it's possible to add you own mapping in unit tests.

## Field Summary

### Fields inherited from interface org.apache.sling.i18n.ResourceBundleProvider

`BUNDLE_REQ_ATTR`

## Constructor Summary

Constructors
Constructor
Description
`MockResourceBundleProvider()`

## Method Summary

Modifier and Type
Method
Description
`Locale`
`getDefaultLocale()`
`ResourceBundle`
`getResourceBundle(String baseName, Locale locale)`
`ResourceBundle`
`getResourceBundle(Locale locale)`
`void`
`setDefaultLocale(Locale defaultLocale)`
Sets the default locale.

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

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

## Constructor Details

### MockResourceBundleProvider

public MockResourceBundleProvider()

## Method Details

### getDefaultLocale

public Locale getDefaultLocale()

Specified by:
  `getDefaultLocale` in interface `org.apache.sling.i18n.ResourceBundleProvider`

### getResourceBundle

public ResourceBundle getResourceBundle(Locale locale)

Specified by:
  `getResourceBundle` in interface `org.apache.sling.i18n.ResourceBundleProvider`

### getResourceBundle

public ResourceBundle getResourceBundle(String baseName, Locale locale)

Specified by:
  `getResourceBundle` in interface `org.apache.sling.i18n.ResourceBundleProvider`

### setDefaultLocale

public void setDefaultLocale(Locale defaultLocale)
Sets the default locale.

Parameters:
  `defaultLocale` - Default locale