/** Test of finding rooms by hotel */
 @Test
 public void findByHotelTest() {
   List<Room> list = new ArrayList<>();
   list.add(room1);
   Hotel hotel = new Hotel();
   when(roomDao.findByHotel(any(Long.class))).thenReturn(list);
   assertEquals((roomService.findByHotel(hotel.getId())).size(), 1);
   verify(roomDao).findByHotel(any(Long.class));
 }
 /** Test of finding room by price */
 @Test
 public void findByPriceTest() {
   List<Room> list = new ArrayList<>();
   list.add(room1);
   list.add(room3);
   BigDecimal price = new BigDecimal("25.0");
   when(roomDao.findRoomByPrice(any(BigDecimal.class))).thenReturn(list);
   assertEquals((roomService.findByPrice(price)).size(), 2);
   verify(roomDao).findRoomByPrice(any(BigDecimal.class));
 }
 /** Test of finfing rooms by number of beds */
 @Test
 public void findByNumberOfBedsTest() {
   List<Room> list = new ArrayList<>();
   list.add(room1);
   list.add(room3);
   int numberOfBeds = 3;
   when(roomDao.findRoomByNumberOfBeds(anyInt())).thenReturn(list);
   assertEquals((roomService.findByNumberOfBeds(numberOfBeds)).size(), 2);
   verify(roomDao).findRoomByNumberOfBeds(anyInt());
 }
 /** Test of finding all rooms */
 @Test
 public void findAllTest() {
   List<Room> list = new ArrayList<>();
   list.add(room1);
   list.add(room2);
   list.add(room3);
   when(roomDao.findAll()).thenReturn(list);
   assertEquals((roomService.findAll()).size(), 3);
   verify(roomDao).findAll();
 }
  /** Test of finding free rooms at specific time */
  @Test
  public void findFreeRoomsAtSpecificTimeTest() {
    List<Reservation> list = new ArrayList<>();
    list.add(reservation1);
    list.add(reservation2);

    when(reservationDao.findReservationsOfTime(any(Date.class), any(Date.class))).thenReturn(list);
    List<Room> reservedRooms =
        roomService.findFreeRoomsAtSpecificTime(nextMonthFirstDay, nextMonthLastDay);

    verify(reservationDao).findReservationsOfTime(any(Date.class), any(Date.class));
    assertFalse(reservedRooms.contains(room1));
    assertFalse(reservedRooms.contains(room2));
  }
 /** Test of deleting room */
 @Test
 public void deleteRoomTest() {
   doAnswer(
           invocationOnMock -> {
             room1 = null;
             return null;
           })
       .when(roomDao)
       .delete(any(Room.class));
   assertNotEquals(room1, null);
   roomService.deleteRoom(room1);
   verify(roomDao).delete(any(Room.class));
   assertEquals(room1, null);
 }
  /** Test of creating room */
  @Test
  public void createRoomTest() {

    doAnswer(
            invocationOnMock -> {
              room1.setId((long) 1);
              return null;
            })
        .when(roomDao)
        .create(any(Room.class));
    assertNotEquals(room1.getId(), new Long("2"));
    roomService.createRoom(room1);
    verify(roomDao).create(any(Room.class));
    assertEquals(room1.getId(), new Long("1"));
  }
 /** Test of updating room */
 @Test
 public void updateRoomTest() {
   String roomName = "Zmenenea izba";
   doAnswer(
           invocationOnMock -> {
             room1.setName(roomName);
             ;
             return null;
           })
       .when(roomDao)
       .update(any(Room.class));
   assertNotEquals(room1.getName(), roomName);
   roomService.updateRoom(room1);
   assertEquals(room1.getName(), roomName);
   verify(roomDao).update(any(Room.class));
 }
  /** Test of changing number of beds in room */
  @Test
  public void changeNumberOfBedsTest() {

    int numberOfBeds = 34;

    doAnswer(
            invocationOnMock -> {
              room1.setNumberOfBeds(numberOfBeds);
              return null;
            })
        .when(roomDao)
        .update(any(Room.class));
    assertNotEquals(room1.getNumberOfBeds(), numberOfBeds);
    roomService.changeNumberOfBeds(room1, numberOfBeds);
    verify(roomDao).update(any(Room.class));
    assertEquals(room1.getNumberOfBeds(), numberOfBeds);
  }
  /** Test of changing price of room */
  @Test
  public void changeRoomPriceTest() {

    BigDecimal price = new BigDecimal("99.0");

    doAnswer(
            invocationOnMock -> {
              room1.setPrice(price);
              return null;
            })
        .when(roomDao)
        .update(any(Room.class));
    assertNotEquals(room1.getPrice(), price);
    roomService.changeRoomPrice(room1, price);
    verify(roomDao).update(any(Room.class));
    assertEquals(room1.getPrice(), price);
  }
 /** Test of finding room by id */
 @Test
 public void findbyIdTest() {
   when(roomDao.findById(any(Long.class))).thenReturn(room1);
   assertEquals(roomService.findById((long) 0), room1);
   verify(roomDao).findById(anyLong());
 }