### Question:
StationServiceImpl implements StationService { @Override public Response queryForId(String stationName, HttpHeaders headers) { Station station = repository.findByName(stationName); if (station != null) { return new Response<>(1, success, station.getId()); } else { return new Response<>(0, "Not exists", stationName); } }  @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 testQueryForId1() { Station station = new Station(); Mockito.when(repository.findByName(Mockito.anyString())).thenReturn(station); Response result = stationServiceImpl.queryForId("station_name", headers); Assert.assertEquals(new Response<>(1, "Success", station.getId()), result); }
@Test public void testQueryForId2() { Mockito.when(repository.findByName(Mockito.anyString())).thenReturn(null); Response result = stationServiceImpl.queryForId("station_name", headers); Assert.assertEquals(new Response<>(0, "Not exists", "station_name"), result); }