FileBasedStubConfigReader { public void readStubConfiguration() { getJsonDescriptorPath(); stubConfigSchema.setSchema(stubConfigSchemaParser.parseSchema()); List<String> stubConfigPaths = cachePathProvider.getConfigPathsFromCache(jsonDescriptorsCachePath); if (!stubConfigPaths.isEmpty()) { stubDescriptorReader.loadSpecificStubDescriptors(stubConfigPaths); } else { stubConfigPaths = cachePathProvider.getConfigPathsFromSpecificFolder(jsonDescriptorsSourceFolderPath, jsonDescriptorsPattern); stubDescriptorReader.loadSpecificStubDescriptors(stubConfigPaths); } }  void readStubConfiguration();  }
@Test public void testReadStubConfigurationShouldLookForStubConfigurationsWhenCacheIsEmpty() { List<String> paths = new ArrayList<>(); paths.add("test"); given(cachePathProvider.getConfigPathsFromSpecificFolder(DESCRIPTOR_PATH, DESCRIPTOR_PATTERN)).willReturn(paths); underTest.readStubConfiguration(); verify(cachePathProvider).getConfigPathsFromSpecificFolder(DESCRIPTOR_PATH, DESCRIPTOR_PATTERN); verify(stubDescriptorReader).loadSpecificStubDescriptors(paths); }
@Test public void testReadStubConfigurationShouldUseTheCachedConfigurations() { List<String> paths = new ArrayList<>(); paths.add("test"); given(cachePathProvider.getConfigPathsFromCache(DESCRIPTOR_CACHE_PATH)).willReturn(paths); underTest.readStubConfiguration(); verify(stubDescriptorReader).loadSpecificStubDescriptors(paths); }
@Test public final void testReadStubConfigurationShouldParseXSDSchema() { given(stubConfigSchemaParser.parseSchema()).willReturn(schema); underTest.readStubConfiguration(); verify(stubConfigSchema).setSchema(schema); }