### Question:
SearchVehiclesAdapter { public SearchVehiclesHttpResponse searchVehicles(final ZonedDateTime pickupDate, final String pickupLocation, final ZonedDateTime returnDate, final String returnLocation) { if (isValidInput(pickupDate, pickupLocation, returnDate, returnLocation)) { final SearchVehiclesInputData searchVehiclesInputData = new SearchVehiclesInputData( pickupDate, pickupLocation, returnDate, returnLocation); inputPort.searchVehicles(searchVehiclesInputData, outputPort); } else { outputPort .setHttpResponse(new HttpResponse(HttpStatus.BAD_REQUEST, "Invalid input data!")); } return outputPort; } SearchVehiclesAdapter(final SearchVehiclesInputPort inputPort); SearchVehiclesHttpResponse searchVehicles(final ZonedDateTime pickupDate,
        final String pickupLocation, final ZonedDateTime returnDate, final String returnLocation);  }### Answer:
@Test public void test_searchVehicles_returnsVehicleCategories() { final ZonedDateTime pickupDate = ZonedDateTime.now(); final SearchVehiclesAdapter searchVehiclesAdapter = new SearchVehiclesAdapter( new MockSearchVehiclesInputPort()); final SearchVehiclesHttpResponse searchVehiclesHttpResponse = searchVehiclesAdapter .searchVehicles(pickupDate, "pickup", pickupDate.plusHours(1), "return"); Assertions.assertFalse(searchVehiclesHttpResponse.getVehicleCategories().isEmpty()); }
@Test public void test_searchVehicles_invalidReturnDate_throwsException() { Assertions.assertThrows(IllegalArgumentException.class, () -> { final ZonedDateTime pickupDate = ZonedDateTime.now(); final ZonedDateTime returnDate = pickupDate; final SearchVehiclesAdapter searchVehiclesAdapter = new SearchVehiclesAdapter( new MockSearchVehiclesInputPort()); searchVehiclesAdapter.searchVehicles(pickupDate, "pickup", returnDate, "return"); }); }
@Test public void test_searchVehicles_invalidInput_returnsBadRequest() { final ZonedDateTime pickupDate = ZonedDateTime.now(); final SearchVehiclesAdapter searchVehiclesAdapter = new SearchVehiclesAdapter( new MockSearchVehiclesInputPort()); final SearchVehiclesHttpResponse searchVehiclesHttpResponse = searchVehiclesAdapter .searchVehicles(pickupDate, "pickup", null, "return"); Assertions.assertEquals(HttpStatus.BAD_REQUEST, searchVehiclesHttpResponse.getHttpResponse().getStatus()); }