### Question:
StationServiceImpl implements StationService { @Override public Response query(HttpHeaders headers) { List<Station> stations = repository.findAll(); if (stations != null && !stations.isEmpty()) { return new Response<>(1, "Find all content", stations); } else { return new Response<>(0, "No content", null); } }  @Override Response create(Station station, HttpHeaders headers); @Override boolean exist(String stationName, HttpHeaders headers); @Override Response update(Station info, HttpHeaders headers); @Override Response delete(Station info, HttpHeaders headers); @Override Response query(HttpHeaders headers); @Override Response queryForId(String stationName, HttpHeaders headers); @Override Response queryForIdBatch(List<String> nameList, HttpHeaders headers); @Override Response queryById(String stationId, HttpHeaders headers); @Override Response queryByIdBatch(List<String> idList, HttpHeaders headers);  }### Answer:
@Test public void testQuery1() { List<Station> stations = new ArrayList<>(); stations.add(new Station()); Mockito.when(repository.findAll()).thenReturn(stations); Response result = stationServiceImpl.query(headers); Assert.assertEquals(new Response<>(1, "Find all content", stations), result); }
@Test public void testQuery2() { Mockito.when(repository.findAll()).thenReturn(null); Response result = stationServiceImpl.query(headers); Assert.assertEquals(new Response<>(0, "No content", null), result); }