### Question:
AdminTravelServiceImpl implements AdminTravelService { @Override public Response updateTravel(TravelInfo request, HttpHeaders headers) { Response result; String requestUrl = ""; if (request.getTrainTypeId().charAt(0) == 'G' || request.getTrainTypeId().charAt(0) == 'D') { requestUrl = "http: } else { requestUrl = "http: } HttpEntity requestEntity = new HttpEntity(request, headers); ResponseEntity<Response> re = restTemplate.exchange( requestUrl, HttpMethod.PUT, requestEntity, Response.class); result = re.getBody(); AdminTravelServiceImpl.LOGGER.info("[Admin Travel Service][Admin update travel]"); return result; }  @Override Response getAllTravels(HttpHeaders headers); @Override Response addTravel(TravelInfo request, HttpHeaders headers); @Override Response updateTravel(TravelInfo request, HttpHeaders headers); @Override Response deleteTravel(String tripId, HttpHeaders headers);  }### Answer:
@Test public void testUpdateTravel1() { TravelInfo request = new TravelInfo(null, null, "G", null, null, null, null, null, null); HttpEntity<TravelInfo> requestEntity2 = new HttpEntity<>(request, headers); Response response = new Response(); ResponseEntity<Response> re = new ResponseEntity<>(response, HttpStatus.OK); Mockito.when(restTemplate.exchange( "http: HttpMethod.PUT, requestEntity2, Response.class)).thenReturn(re); Response result = adminTravelServiceImpl.updateTravel(request, headers); Assert.assertEquals(new Response<>(null, null, null), result); }
@Test public void testUpdateTravel2() { TravelInfo request = new TravelInfo(null, null, "K", null, null, null, null, null, null); HttpEntity<TravelInfo> requestEntity2 = new HttpEntity<>(request, headers); Response response = new Response(); ResponseEntity<Response> re = new ResponseEntity<>(response, HttpStatus.OK); Mockito.when(restTemplate.exchange( "http: HttpMethod.PUT, requestEntity2, Response.class)).thenReturn(re); Response result = adminTravelServiceImpl.updateTravel(request, headers); Assert.assertEquals(new Response<>(null, null, null), result); }