### Question:
Hotel { public void cancelRoomBooking(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()) { var updateRoomBooking = room.get(); updateRoomBooking.setBooked(false); int refundAmount = updateRoomBooking.getPrice(); hotelDao.update(updateRoomBooking); LOGGER.info("Booking cancelled for room number: " + roomNumber); LOGGER.info(refundAmount + " is refunded"); } else { throw new Exception("No booking for the room exists"); } } } Hotel(HotelDaoImpl hotelDao); void bookRoom(int roomNumber); void cancelRoomBooking(int roomNumber);  }### Answer:
@Test public void cancelRoomBookingWithInvalidIdShouldRaiseException() { assertThrows(Exception.class, () -> { hotel.cancelRoomBooking(getNonExistingRoomId()); }); }
@Test public void cancelRoomBookingForUnbookedRoomShouldRaiseException() { assertThrows(Exception.class, () -> { hotel.cancelRoomBooking(1); }); }