### Question:
ConfigServiceImpl implements ConfigService { @Override public Response delete(String name, HttpHeaders headers) { Config config = repository.findByName(name); if (config == null) { String result = config0 + name + " doesn't exist."; return new Response<>(0, result, null); } else { repository.deleteByName(name); return new Response<>(1, "Delete 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 testDelete1() { Mockito.when(repository.findByName("name")).thenReturn(null); Response result = configServiceImpl.delete("name", headers); Assert.assertEquals(new Response<>(0, "Config name doesn't exist.", null), result); }
@Test public void testDelete2() { Config info = new Config(); Mockito.when(repository.findByName("name")).thenReturn(info); Mockito.doNothing().doThrow(new RuntimeException()).when(repository).deleteByName("name"); Response result = configServiceImpl.delete("name", headers); Assert.assertEquals(new Response<>(1, "Delete success", info), result); }