@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);
  }
  @Test
  public void testDeleteBooking() {
    bookingDao.addBooking(booking);

    when(bookingDao.getBookingById(booking.getId())).thenReturn(booking);
    Assert.assertNotNull(bookingService.getBookingById(booking.getId()));

    bookingDao.deleteBooking(booking);

    when(bookingDao.getBookingById(booking.getId())).thenReturn(null);
    Assert.assertNull(bookingService.getBookingById(booking.getId()));
  }
 @BeforeMethod
 public void setUp() throws ParseException {
   MockitoAnnotations.initMocks(this);
   booking = new Booking();
   String sourceDate = "2012-02-29";
   SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
   d = format.parse(sourceDate);
   booking.setCheckIn(d);
 }