### Question:
RentVehicleController { @PostMapping(value = ENDPOINT) public ResponseEntity rentVehicle(@RequestBody Reservation reservation) { ResponseEntity responseEntity; final HttpResponse httpResponse = adapter.rentVehicle(reservation); switch (httpResponse.getStatus()) { case CREATED: reservation.setId(adapter.getRentId()); responseEntity = ResponseEntity .created(URI.create(ENDPOINT + "/" + reservation.getId())).body(reservation); break; case CONFLICT: responseEntity = ResponseEntity.status(HttpStatus.CONFLICT).build(); break; case BAD_REQUEST: responseEntity = ResponseEntity.badRequest().body(httpResponse); break; default: responseEntity = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(httpResponse); } return responseEntity; } RentVehicleController(final RentVehicleInputPort inputPort); @PostMapping(value = ENDPOINT) ResponseEntity rentVehicle(@RequestBody Reservation reservation);  }### Answer:
@Test void test_rentVehicle_null_doesNotRent() { final RentVehicleController controller = new RentVehicleController( new MockRentVehicleInputPort()); final ResponseEntity<?> responseEntity = controller.rentVehicle(null); Assertions.assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode()); }
@Test void test_rentVehicle_reservation_rents() { final RentVehicleController controller = new RentVehicleController( new MockRentVehicleInputPort()); final Reservation reservation = createReservation(); final ResponseEntity<?> responseEntity = controller.rentVehicle(reservation); Assertions.assertEquals(ResponseEntity .created(URI.create(RentVehicleController.ENDPOINT + "/" + reservation.getId())) .body(reservation), responseEntity); }
@Test void test_rentVehicle_reservation_returnsRentId() { final RentVehicleController controller = new RentVehicleController( new MockRentVehicleInputPort()); final Reservation reservation = createReservation(); controller.rentVehicle(reservation); Assertions.assertFalse(reservation.getId().isEmpty()); }