### Question:
Hotel { public void bookRoom(int roomNumber) throws Exception { var room = hotelDao.getById(roomNumber); if (room.isEmpty()) { throw new Exception("Room number: " + roomNumber + " does not exist"); } else { if (room.get().isBooked()) { throw new Exception("Room already booked!"); } else { var updateRoomBooking = room.get(); updateRoomBooking.setBooked(true); hotelDao.update(updateRoomBooking); } } } Hotel(HotelDaoImpl hotelDao); void bookRoom(int roomNumber); void cancelRoomBooking(int roomNumber);  }### Answer:
@Test public void bookingRoomShouldChangeBookedStatusToTrue() throws Exception { hotel.bookRoom(1); assertTrue(dao.getById(1).get().isBooked()); }
@Test() public void bookingRoomWithInvalidIdShouldRaiseException() { assertThrows(Exception.class, () -> { hotel.bookRoom(getNonExistingRoomId()); }); }
@Test() public void bookingRoomAgainShouldRaiseException() { assertThrows(Exception.class, () -> { hotel.bookRoom(1); hotel.bookRoom(1); }); }