SensorParserConfigServiceImpl implements SensorParserConfigService { @Override public List<String> getAllTypes() throws RestException { ParserConfigurations configs = cache.get( ParserConfigurations.class); return configs.getTypes(); } @Autowired  SensorParserConfigServiceImpl(ObjectMapper objectMapper, CuratorFramework client,
      GrokService grokService, ConfigurationsCache cache); @Override SensorParserConfig save(String name, SensorParserConfig sensorParserConfig); @Override SensorParserConfig findOne(String name); @Override Map<String, SensorParserConfig> getAll(); @Override boolean delete(String name); @Override List<String> getAllTypes(); @Override Map<String, String> getAvailableParsers(); @Override Map<String, String> reloadAvailableParsers(); @Override JSONObject parseMessage(ParseMessageRequest parseMessageRequest);  }
@Test public void getAllTypesShouldProperlyReturnTypes() throws Exception { ParserConfigurations configs = new ParserConfigurations(){ @Override public Map<String, Object> getConfigurations() { return ImmutableMap.of(ParserConfigurations.getKey("bro"), new HashMap<>() ,ParserConfigurations.getKey("squid"), new HashMap<>() ); } }; when(cache.get( eq(ParserConfigurations.class))) .thenReturn(configs); assertEquals(new ArrayList<String>() {{ add("bro"); add("squid"); }}, sensorParserConfigService.getAllTypes()); }