SensorParserConfigServiceImpl implements SensorParserConfigService { @Override public SensorParserConfig findOne(String name) throws RestException { ParserConfigurations configs = cache.get( ParserConfigurations.class); return configs.getSensorParserConfig(name); } @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 findOneShouldProperlyReturnSensorParserConfig() throws Exception { final SensorParserConfig sensorParserConfig = getTestBroSensorParserConfig(); ParserConfigurations configs = new ParserConfigurations(){ @Override public Map<String, Object> getConfigurations() { return ImmutableMap.of(ParserConfigurations.getKey("bro"), sensorParserConfig); } }; when(cache.get(eq(ParserConfigurations.class))) .thenReturn(configs); assertEquals(getTestBroSensorParserConfig(), sensorParserConfigService.findOne("bro")); assertNull(sensorParserConfigService.findOne("blah")); }