updates
This commit is contained in:
@@ -39,7 +39,7 @@ public final class TestReservations {
|
||||
|
||||
// 4. Request that Manager updates specific account’s files with data stored in
|
||||
// memory
|
||||
mgr.UpdateAccount(mgr.retrieveAccount(acct.account_number()));
|
||||
mgr.UpdateAccount(acct);
|
||||
// 5. Add draft lodging reservation to an account (if reservation object already
|
||||
// exists with the same reservation number, it is considered an error)
|
||||
|
||||
@@ -52,10 +52,10 @@ public final class TestReservations {
|
||||
hotel.setSquareFeet(450);
|
||||
hotel.setReservation_start_date(ZonedDateTime.of(2025, 07, 05, 10, 0, 0, 0, ZoneId.of("UTC")));
|
||||
hotel.setReservation_end_date(ZonedDateTime.of(2025, 11, 30, 22, 0, 0, 0, ZoneId.of("UTC")));
|
||||
boolean success1 = mgr.addReservation(mgr.retrieveAccount(acct.account_number()), hotel);
|
||||
boolean success1 = mgr.addReservation(acct, hotel);
|
||||
assert success1;
|
||||
|
||||
mgr.UpdateAccount(mgr.retrieveAccount(acct.account_number()));
|
||||
mgr.UpdateAccount(acct);
|
||||
|
||||
CabinReservation cabin = new CabinReservation();
|
||||
cabin.setPhysical_address(new Address("30 cabin ave", "Carnelian", "CA", "96140"));
|
||||
@@ -66,9 +66,11 @@ public final class TestReservations {
|
||||
cabin.setSquareFeet(806);
|
||||
cabin.setReservation_start_date(ZonedDateTime.of(2025, 07, 05, 10, 0, 0, 0, ZoneId.of("UTC")));
|
||||
cabin.setReservation_end_date(ZonedDateTime.of(2025, 11, 30, 22, 0, 0, 0, ZoneId.of("UTC")));
|
||||
boolean success2 = mgr.addReservation(mgr.retrieveAccount(acct.account_number()), cabin);
|
||||
boolean success2 = mgr.addReservation(acct, cabin);
|
||||
assert success2;
|
||||
|
||||
mgr.UpdateAccount(acct);
|
||||
|
||||
HouseReservation house = new HouseReservation();
|
||||
house.setPhysical_address(new Address("3000 Osage ave", "GreenBelt", "MD", "20740"));
|
||||
house.setMailing_address(new Address("40012 College ave", "College Park", "MD", "20740"));
|
||||
@@ -78,17 +80,21 @@ public final class TestReservations {
|
||||
house.setSquareFeet(1400);
|
||||
house.setReservation_start_date(ZonedDateTime.of(2025, 07, 05, 10, 0, 0, 0, ZoneId.of("UTC")));
|
||||
house.setReservation_end_date(ZonedDateTime.of(2025, 11, 30, 22, 0, 0, 0, ZoneId.of("UTC")));
|
||||
boolean success3 = mgr.addReservation(mgr.retrieveAccount(acct.account_number()), house);
|
||||
boolean success3 = mgr.addReservation(acct, house);
|
||||
assert success3;
|
||||
|
||||
Reservation rsrv = (Reservation) cabin;
|
||||
mgr.UpdateAccount(acct);
|
||||
|
||||
|
||||
try {
|
||||
assert mgr.addReservation(acct, cabin);
|
||||
mgr.addReservation(acct, cabin);
|
||||
mgr.UpdateAccount(mgr.retrieveAccount(acct.account_number()));
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error: cabin already in list.");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
mgr.UpdateAccount(mgr.retrieveAccount(acct.account_number()));
|
||||
Account account = mgr.retrieveLoadedAccounts().getFirst();
|
||||
Reservation rsrv = account.getReservation_list().getLast();
|
||||
|
||||
// 6. Complete reservation that is associated with an account
|
||||
rsrv = mgr.retreiveReservation(cabin.getReservation_number());
|
||||
|
||||
Reference in New Issue
Block a user