@Test public void testAddBooking() { when(bookingDao.getBookingById(booking.getId())).thenReturn(booking); bookingService.addBooking(booking); Assert.assertEquals(bookingService.getBookingById(booking.getId()).getCheckIn(), d); }
@Test public void testGetBookingById() { bookingService.addBooking(booking); when(bookingDao.getBookingById(booking.getId())).thenReturn(booking); Booking output = bookingService.getBookingById(booking.getId()); Assert.assertEquals(output.getCheckIn(), booking.getCheckIn()); }
@Test public void testUpdateBooking() { bookingService.addBooking(booking); Date newDate = addDays(d, 1); booking.setCheckIn(newDate); bookingService.updateBooking(booking); when(bookingDao.getBookingById(booking.getId())).thenReturn(booking); Assert.assertEquals(bookingService.getBookingById(booking.getId()).getCheckIn(), newDate); }