SensorIndexingConfigServiceImpl implements SensorIndexingConfigService { @Override public Map<String, Map<String, Object>> getAll() throws RestException { Map<String, Map<String, Object>> sensorIndexingConfigs = new HashMap<>(); List<String> sensorNames = getAllTypes(); for (String name : sensorNames) { Map<String, Object> config = findOne(name); if(config != null) { sensorIndexingConfigs.put(name, config); } } return sensorIndexingConfigs; } @Autowired  SensorIndexingConfigServiceImpl(ObjectMapper objectMapper, CuratorFramework client, ConfigurationsCache cache); @Override Map<String, Object> save(String name, Map<String, Object> sensorIndexingConfig); @Override Map<String, Object> findOne(String name); @Override Map<String, Map<String, Object>> getAll(); @Override List<String> getAllTypes(); @Override Iterable<String> getAllIndices(String writerName); @Override boolean delete(String name);  }
@Test public void getAllShouldProperlyReturnIndexingConfigs() throws Exception { final Map<String, Object> sensorIndexingConfig = getTestSensorIndexingConfig(); IndexingConfigurations configs = new IndexingConfigurations(){ @Override public Map<String, Object> getConfigurations() { return ImmutableMap.of(IndexingConfigurations.getKey("bro"), sensorIndexingConfig ); } }; when(cache.get(eq(IndexingConfigurations.class))) .thenReturn(configs); assertEquals(new HashMap() {{ put("bro", sensorIndexingConfig);}}, sensorIndexingConfigService.getAll()); }