### Question:
StationServiceImpl implements StationService { @Override public Response delete(Station info, HttpHeaders headers) { if (repository.findById(info.getId()) != null) { Station station = new Station(info.getId(), info.getName()); repository.delete(station); return new Response<>(1, "Delete success", station); } return new Response<>(0, "Station not exist", 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 testDelete1() { Station info = new Station(); Mockito.when(repository.findById(Mockito.anyString())).thenReturn(info); Mockito.doNothing().doThrow(new RuntimeException()).when(repository).delete(Mockito.any(Station.class)); Response result = stationServiceImpl.delete(info, headers); Assert.assertEquals("Delete success", result.getMsg()); }
@Test public void testDelete2() { Station info = new Station(); Mockito.when(repository.findById(Mockito.anyString())).thenReturn(null); Response result = stationServiceImpl.delete(info, headers); Assert.assertEquals(new Response<>(0, "Station not exist", null), result); }