FrontendTokenDefinitionRegistryImpl implements FrontendTokenDefinitionRegistry { protected FrontendTokenDefinitionImpl getFrontendTokenDefinitionImpl( Bundle bundle) { String json = getFrontendTokenDefinitionJSON(bundle); if (json == null) { return null; } return new FrontendTokenDefinitionImpl( json, jsonFactory, resourceBundleLoaders.getService(bundle.getSymbolicName()), getThemeId(bundle)); }  @Override FrontendTokenDefinition getFrontendTokenDefinition(String themeId); @Override Collection<FrontendTokenDefinition> getFrontendTokenDefinitions();  }
@Test public void testGetJSON() throws IOException { FrontendTokenDefinitionRegistryImpl frontendTokenDefinitionRegistryImpl = new FrontendTokenDefinitionRegistryImpl(); frontendTokenDefinitionRegistryImpl.resourceBundleLoaders = Mockito.mock(ServiceTrackerMap.class); Bundle bundle = Mockito.mock(Bundle.class); Mockito.when( bundle.getEntry("WEB-INF/frontend-token-definition.json") ).thenReturn( _frontendTokenDefinitionJSONURL ); Mockito.when( bundle.getHeaders(Mockito.anyString()) ).thenReturn( new HashMapDictionary<>() ); FrontendTokenDefinition frontendTokenDefinition = frontendTokenDefinitionRegistryImpl.getFrontendTokenDefinitionImpl( bundle); try (InputStream inputStream = _frontendTokenDefinitionJSONURL.openStream()) { Assert.assertEquals( StringUtil.read(inputStream), frontendTokenDefinition.getJSON(LocaleUtil.ENGLISH)); } }