### Question:
RouteServiceImpl implements RouteService { @Override public Response deleteRoute(String routeId, HttpHeaders headers) { routeRepository.removeRouteById(routeId); Route route = routeRepository.findById(routeId); if (route == null) { return new Response<>(1, "Delete Success", routeId); } else { return new Response<>(0, "Delete failed, Reason unKnown with this routeId", routeId); } }  @Override Response createAndModify(RouteInfo info, HttpHeaders headers); @Override Response deleteRoute(String routeId, HttpHeaders headers); @Override Response getRouteById(String routeId, HttpHeaders headers); @Override Response getRouteByStartAndTerminal(String startId, String terminalId, HttpHeaders headers); @Override Response getAllRoutes(HttpHeaders headers);  }### Answer:
@Test public void testDeleteRoute1() { Mockito.doNothing().doThrow(new RuntimeException()).when(routeRepository).removeRouteById(Mockito.anyString()); Mockito.when(routeRepository.findById(Mockito.anyString())).thenReturn(null); Response result = routeServiceImpl.deleteRoute("route_id", headers); Assert.assertEquals(new Response<>(1, "Delete Success", "route_id"), result); }
@Test public void testDeleteRoute2() { Route route = new Route(); Mockito.doNothing().doThrow(new RuntimeException()).when(routeRepository).removeRouteById(Mockito.anyString()); Mockito.when(routeRepository.findById(Mockito.anyString())).thenReturn(route); Response result = routeServiceImpl.deleteRoute("route_id", headers); Assert.assertEquals(new Response<>(0, "Delete failed, Reason unKnown with this routeId", "route_id"), result); }