CacheConfigurationProvider implements ConfigurationProvider { @Override public Configuration getConfiguration(String contentType, Integer version, Map<String, List<String>> parameters) throws ConfigurationProviderException { return configurationCache.getCacheFileInfo(contentType, parameters).getConfiguration(version); } CacheConfigurationProvider(List<String> contentTypes, ConfigurationCache configurationCache); @Override List<String> getContentTypes(); @Override Configuration getConfiguration(String contentType, Integer version, Map<String, List<String>> parameters);  }
@Test public void testGetConfiguration() throws ConfigurationProviderException { int version = 99; ConfigurationCacheFileInfo configurationCacheFileInfo = mock(ConfigurationCacheFileInfo.class); ConfigurationCacheFileInfo configurationCacheFileInfo2 = mock(ConfigurationCacheFileInfo.class); WriteableConfiguration configuration = mock(WriteableConfiguration.class); WriteableConfiguration configuration2 = mock(WriteableConfiguration.class); Map<String, List<String>> parameters = mock(Map.class); when(configConfigurationCache.getCacheFileInfo(TEST_CONTENT_TYPE, parameters)).thenReturn(configurationCacheFileInfo); when(configConfigurationCache.getCacheFileInfo(TEST_CONTENT_TYPE_2, parameters)).thenReturn(configurationCacheFileInfo2); when(configurationCacheFileInfo.getConfiguration(version)).thenReturn(configuration); when(configurationCacheFileInfo2.getConfiguration(version)).thenReturn(configuration2); assertEquals(configuration, cacheConfigurationProvider.getConfiguration(TEST_CONTENT_TYPE, version, parameters)); assertEquals(configuration2, cacheConfigurationProvider.getConfiguration(TEST_CONTENT_TYPE_2, version, parameters)); }