#1321 Added UML diagram
This commit is contained in:
@ -47,6 +47,7 @@ public class TransactionScriptApp {
|
||||
deleteSchema(dataSource);
|
||||
createSchema(dataSource);
|
||||
final var dao = new HotelDaoImpl(dataSource);
|
||||
|
||||
addRooms(dao);
|
||||
|
||||
getRoomStatus(dao);
|
||||
@ -97,7 +98,7 @@ public class TransactionScriptApp {
|
||||
*
|
||||
* @return h2 datasource
|
||||
*/
|
||||
public static DataSource createDataSource() {
|
||||
private static DataSource createDataSource() {
|
||||
JdbcDataSource dataSource = new JdbcDataSource();
|
||||
dataSource.setUrl(H2_DB_URL);
|
||||
return dataSource;
|
||||
@ -114,7 +115,7 @@ public class TransactionScriptApp {
|
||||
*
|
||||
* @return list of rooms
|
||||
*/
|
||||
public static List<Room> generateSampleRooms() {
|
||||
private static List<Room> generateSampleRooms() {
|
||||
final var room1 = new Room(1, "Single", 50, false);
|
||||
final var room2 = new Room(2, "Double", 80, false);
|
||||
final var room3 = new Room(3, "Queen", 120, false);
|
||||
|
@ -261,7 +261,6 @@ public class HotelDaoImplTest {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An arbitrary number which does not correspond to an active Room id.
|
||||
*
|
||||
|
@ -63,7 +63,7 @@ public class HotelTest {
|
||||
@Test()
|
||||
public void bookingRoomWithInvalidIdShouldRaiseException() {
|
||||
assertThrows(Exception.class, () -> {
|
||||
hotel.bookRoom(999);
|
||||
hotel.bookRoom(getNonExistingRoomId());
|
||||
});
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public class HotelTest {
|
||||
@Test
|
||||
public void cancelRoomBookingWithInvalidIdShouldRaiseException() {
|
||||
assertThrows(Exception.class, () -> {
|
||||
hotel.cancelRoomBooking(999);
|
||||
hotel.cancelRoomBooking(getNonExistingRoomId());
|
||||
});
|
||||
}
|
||||
|
||||
@ -140,4 +140,13 @@ public class HotelTest {
|
||||
final var room6 = new Room(6, "Double", 80, false);
|
||||
return List.of(room1, room2, room3, room4, room5, room6);
|
||||
}
|
||||
|
||||
/**
|
||||
* An arbitrary number which does not correspond to an active Room id.
|
||||
*
|
||||
* @return an int of a room id which doesn't exist
|
||||
*/
|
||||
private int getNonExistingRoomId() {
|
||||
return 999;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user