### Question:
DefaultTranslationBundleContext implements TranslationBundleContext { @Override public Collection<TranslationBundle> getBundles() { return getCurrentBundlesInternal(); }  @Override Collection<TranslationBundle> getBundles(); @Override void addBundle(TranslationBundle bundle); static final String CKEY_BUNDLES; }### Answer:
@Test public void getBundlesNewContext() throws Exception { when(this.mockContextComponentManagerProvider.get()).thenReturn(this.mocker); TranslationBundle mockTranslationBundle = this.mocker.registerMockComponent(TranslationBundle.class); Collection<TranslationBundle> bundles = this.mocker.getComponentUnderTest().getBundles(); assertNotNull(this.mockExecutionContext.getProperty(DefaultTranslationBundleContext.CKEY_BUNDLES)); assertEquals(1, bundles.size()); assertEquals(mockTranslationBundle, bundles.iterator().next()); }
@Test public void getBundlesSwitchContext() throws Exception { ComponentManager mockWiki1ComponentManager = mock(ComponentManager.class); when(this.mockContextComponentManagerProvider.get()).thenReturn(mockWiki1ComponentManager); TranslationBundle mockWiki1TranslationBundle = mock(TranslationBundle.class); List<TranslationBundle> wiki1Bundles = Arrays.asList(mockWiki1TranslationBundle); when(mockWiki1ComponentManager.<TranslationBundle>getInstanceList(TranslationBundle.class)).thenReturn( wiki1Bundles); Collection<TranslationBundle> firstBundles = this.mocker.getComponentUnderTest().getBundles(); assertEquals(1, firstBundles.size()); assertEquals(mockWiki1TranslationBundle, firstBundles.iterator().next()); when(this.mockModelContext.getCurrentEntityReference()).thenReturn(new WikiReference("otherWiki")); ComponentManager mockWiki2ComponentManager = mock(ComponentManager.class); when(this.mockContextComponentManagerProvider.get()).thenReturn(mockWiki2ComponentManager); TranslationBundle mockWiki2TranslationBundle = mock(TranslationBundle.class); List<TranslationBundle> wiki2Bundles = Arrays.asList(mockWiki2TranslationBundle); when(mockWiki2ComponentManager.<TranslationBundle>getInstanceList(TranslationBundle.class)).thenReturn( wiki2Bundles); Collection<TranslationBundle> secondBundles = this.mocker.getComponentUnderTest().getBundles(); assertEquals(1, secondBundles.size()); assertEquals(mockWiki2TranslationBundle, secondBundles.iterator().next()); assertNotEquals(firstBundles.iterator().next(), secondBundles.iterator().next()); when(this.mockModelContext.getCurrentEntityReference()).thenReturn(new WikiReference("currentWiki")); Collection<TranslationBundle> thirdBundles = this.mocker.getComponentUnderTest().getBundles(); assertEquals(firstBundles.iterator().next(), thirdBundles.iterator().next()); }