Search in sources :

Example 11 with TranslationBundle

use of org.xwiki.localization.TranslationBundle in project xwiki-platform by xwiki.

the class DefaultTranslationBundleContextTest method addBundlesToCurrentContext.

@Test
public void addBundlesToCurrentContext() throws Exception {
    // Map the context component manager to the test component manager for easier test setup.
    when(this.mockContextComponentManagerProvider.get()).thenReturn(this.mocker);
    Collection<TranslationBundle> bundles = this.mocker.getComponentUnderTest().getBundles();
    // No bundles.
    assertEquals(0, bundles.size());
    // Add a bundle
    TranslationBundle mockBundleToAdd = mock(TranslationBundle.class);
    this.mocker.getComponentUnderTest().addBundle(mockBundleToAdd);
    bundles = this.mocker.getComponentUnderTest().getBundles();
    // Check that it was added.
    assertEquals(1, bundles.size());
    assertTrue(bundles.contains(mockBundleToAdd));
}
Also used : TranslationBundle(org.xwiki.localization.TranslationBundle) Test(org.junit.Test)

Aggregations

TranslationBundle (org.xwiki.localization.TranslationBundle)11 ComponentManager (org.xwiki.component.manager.ComponentManager)4 Test (org.junit.Test)3 MalformedURLException (java.net.MalformedURLException)2 InitializationException (org.xwiki.component.phase.InitializationException)2 Scope (org.xwiki.localization.wiki.internal.TranslationDocumentModel.Scope)2 File (java.io.File)1 Locale (java.util.Locale)1 TreeSet (java.util.TreeSet)1 Expectations (org.jmock.Expectations)1 Mockery (org.jmock.Mockery)1 JUnit4Mockery (org.jmock.integration.junit4.JUnit4Mockery)1 ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)1 LocalizationContext (org.xwiki.localization.LocalizationContext)1 LocalizationManager (org.xwiki.localization.LocalizationManager)1 Translation (org.xwiki.localization.Translation)1 WikiReference (org.xwiki.model.reference.WikiReference)1 Block (org.xwiki.rendering.block.Block)1 WordBlock (org.xwiki.rendering.block.WordBlock)1