@Test public void getConfig4() throws Exception { expect(mockConfig1.getConfigName()).andReturn("config1"); expect(mockConfig2.getConfigName()).andReturn("config2"); expect(mockConfig3.getConfigName()).andReturn("config3"); replayAll(); String returned = unit.getConfigAsJson("config_no_such"); verifyAll(); assertEquals(returned, "{}"); }
public String getConfigAsJson(String name) { String rc = "{}"; try { Optional<AcmConfig> optionalRcString = configList.stream().filter(x -> x.getConfigName().equals(name)).findFirst(); if (optionalRcString.isPresent()) rc = optionalRcString.get().getConfigAsJson(); } catch (NoSuchElementException e) { log.error(e.getMessage()); } return rc; }
ConfigService { public String getConfigAsJson(String name) { String rc = "{}"; try { Optional<AcmConfig> optionalRcString = configList.stream().filter(x -> x.getConfigName().equals(name)).findFirst(); if (optionalRcString.isPresent()) rc = optionalRcString.get().getConfigAsJson(); } catch (NoSuchElementException e) { log.error(e.getMessage()); } return rc; } }
ConfigService { public String getConfigAsJson(String name) { String rc = "{}"; try { Optional<AcmConfig> optionalRcString = configList.stream().filter(x -> x.getConfigName().equals(name)).findFirst(); if (optionalRcString.isPresent()) rc = optionalRcString.get().getConfigAsJson(); } catch (NoSuchElementException e) { log.error(e.getMessage()); } return rc; }  }
ConfigService { public String getConfigAsJson(String name) { String rc = "{}"; try { Optional<AcmConfig> optionalRcString = configList.stream().filter(x -> x.getConfigName().equals(name)).findFirst(); if (optionalRcString.isPresent()) rc = optionalRcString.get().getConfigAsJson(); } catch (NoSuchElementException e) { log.error(e.getMessage()); } return rc; }  List<Map<String, String>> getInfo(); String getConfigAsJson(String name); List<AcmConfig> getConfigList(); void setConfigList(List<AcmConfig> configList); }
ConfigService { public String getConfigAsJson(String name) { String rc = "{}"; try { Optional<AcmConfig> optionalRcString = configList.stream().filter(x -> x.getConfigName().equals(name)).findFirst(); if (optionalRcString.isPresent()) rc = optionalRcString.get().getConfigAsJson(); } catch (NoSuchElementException e) { log.error(e.getMessage()); } return rc; }  List<Map<String, String>> getInfo(); String getConfigAsJson(String name); List<AcmConfig> getConfigList(); void setConfigList(List<AcmConfig> configList);  }