### Question:
ConfigServiceImpl implements ConfigService { @Override public Response update(Config info, HttpHeaders headers) { if (repository.findByName(info.getName()) == null) { String result = config0 + info.getName() + " doesn't exist."; return new Response<>(0, result, null); } else { Config config = new Config(info.getName(), info.getValue(), info.getDescription()); repository.save(config); return new Response<>(1, "Update success", config); } }  @Override Response create(Config info, HttpHeaders headers); @Override Response update(Config info, HttpHeaders headers); @Override Response query(String name, HttpHeaders headers); @Override Response delete(String name, HttpHeaders headers); @Override Response queryAll(HttpHeaders headers);  }### Answer:
@Test public void testUpdate1() { Config info = new Config(); Mockito.when(repository.findByName(info.getName())).thenReturn(null); Response result = configServiceImpl.update(info, headers); Assert.assertEquals(new Response<>(0, "Config doesn't exist.", null), result); }
@Test public void testUpdate2() { Config info = new Config("", "", ""); Mockito.when(repository.findByName(info.getName())).thenReturn(info); Mockito.when(repository.save(Mockito.any(Config.class))).thenReturn(null); Response result = configServiceImpl.update(info, headers); Assert.assertEquals(new Response<>(1, "Update success", new Config("", "", "")), result); }