### Question:
ReservationJdbcGateway implements ReservationGateway { @Override public Reservation save(final Reservation reservation) { jdbcTemplate.update( "INSERT INTO RENT_A_CAR.RESERVATION (RENTER, VEHICLE, PICKUP_DATE, PICKUP_LOCATION, RETURN_DATE, RETURN_LOCATION) VALUES (?, ?, ?, ?, ?, ?)", reservation.getRenter().getEmail(), reservation.getVehicle().getId(), Timestamp .from(reservation.getPickupDate().withZoneSameLocal(ZoneOffset.UTC).toInstant()), reservation.getPickupLocation().getName(), Timestamp .from(reservation.getReturnDate().withZoneSameLocal(ZoneOffset.UTC).toInstant()), reservation.getReturnLocation().getName()); return reservation; } ReservationJdbcGateway(final JdbcTemplate jdbcTemplate); @Override Reservation save(final Reservation reservation); @Override Iterable<Reservation> findAllByVehicle(final String vehicleId); @Override Optional<Reservation> findByOverlappingRentPeriod(final String vehicleId,
        final ZonedDateTime pickupDate, final ZonedDateTime returnDate);  }### Answer:
@Test void test_save_reservation_saves() { ZonedDateTime now = ZonedDateTime.now(); final Reservation reservation = createReservation("john.doe@email.com", "vehicle id 1", now, now.plusDays(1)); reservationGateway.save(reservation); Assertions.assertNotNull(reservation); }
@Test void test_save_duplicate_doesNotSave() { ZonedDateTime now = ZonedDateTime.now(); final Reservation reservation = createReservation("john.doe@email.com", "vehicle id 1", now, now.plusDays(1)); reservationGateway.save(reservation); Assertions .assertThrows(DuplicateKeyException.class, () -> reservationGateway.save(reservation)); }