### Question:
ConfigServiceImpl implements ConfigService { @Override public Response query(String name, HttpHeaders headers) { Config config = repository.findByName(name); if (config == null) { return new Response<>(0, "No content", null); } else { return new Response<>(1, "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 testQuery1() { Mockito.when(repository.findByName("name")).thenReturn(null); Response result = configServiceImpl.query("name", headers); Assert.assertEquals(new Response<>(0, "No content", null), result); }
@Test public void testQuery2() { Config info = new Config(); Mockito.when(repository.findByName("name")).thenReturn(info); Response result = configServiceImpl.query("name", headers); Assert.assertEquals(new Response<>(1, "Success", new Config()), result); }