@Test public void testNegativeGetReservationSearchIntervalCloseToStartTime() { // Reservation duration is 10 minutes long reservationStart = Timestamp.valueOf("2050-12-03 10:37:37").getTime(); long reservationEnd = Timestamp.valueOf("2050-12-03 10:47:37").getTime(); // Search interval does not fit within the reservation but is close to // the start time. long searchStart = Timestamp.valueOf("2050-12-03 11:30:37").getTime(); long searchEnd = Timestamp.valueOf("2050-12-03 11:35:37").getTime(); // 60 minute period in milliseconds. long period = 60 * 60 * 1000; testNegativeGetRecurringReservationsHelper(reservationStart, reservationEnd, searchStart, searchEnd, 100, period, 10); }
@Test public void testNegativeGetReservationSearchIntervalCloseToEndTime() { // Reservation duration is 10 minutes long reservationStart = Timestamp.valueOf("2050-12-03 10:37:37").getTime(); long reservationEnd = Timestamp.valueOf("2050-12-03 10:47:37").getTime(); // Reservation does not fit within search interval, but is close to the end // time. long searchStart = Timestamp.valueOf("2050-12-03 10:48:37").getTime(); long searchEnd = Timestamp.valueOf("2050-12-03 10:50:37").getTime(); // 60 minute period in milliseconds. long period = 60 * 60 * 1000; testNegativeGetRecurringReservationsHelper(reservationStart, reservationEnd, searchStart, searchEnd, 100, period, 10); }
@Test public void testGetReservationSearchIntervalBeforeReservationStart() { // Reservation duration is 10 minutes long reservationStart = Timestamp.valueOf("2050-12-03 10:37:37").getTime(); long reservationEnd = Timestamp.valueOf("2050-12-03 10:47:37").getTime(); long searchStart = Timestamp.valueOf("2050-12-03 10:10:37").getTime(); long searchEnd = Timestamp.valueOf("2050-12-03 10:20:37").getTime(); // 10 minute period in milliseconds. long period = 10 * 60 * 1000; // Negative test because even though the reservation would be encompassed // if it was interpolated, it should not be picked up. Also test only one // cycle because if we test more cycles, some of them will pass. testNegativeGetRecurringReservationsHelper(reservationStart, reservationEnd, searchStart, searchEnd, 1, period, 10); }