mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 04:59:21 +00:00
deps: Refactor dependencies (#3224)
* remove spring dep move junit, logging, mockito under dep mgmt * upgrade anti-corruption-layer deps * async method invocation * balking, bloc * bridge to bytecode * caching * callback - cqrs * component - health check * hexagonal - metadata mapping * rest of the patterns * remove checkstyle, take spotless into use
This commit is contained in:
@@ -35,9 +35,7 @@ import org.h2.jdbcx.JdbcDataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests {@link Hotel}
|
||||
*/
|
||||
/** Tests {@link Hotel} */
|
||||
class HotelTest {
|
||||
|
||||
private static final String H2_DB_URL = "jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1";
|
||||
@@ -53,7 +51,6 @@ class HotelTest {
|
||||
dao = new HotelDaoImpl(dataSource);
|
||||
addRooms(dao);
|
||||
hotel = new Hotel(dao);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -68,7 +65,6 @@ class HotelTest {
|
||||
assertThrows(Exception.class, () -> hotel.bookRoom(getNonExistingRoomId()));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SneakyThrows
|
||||
void bookingRoomAgainShouldRaiseException() {
|
||||
@@ -103,17 +99,16 @@ class HotelTest {
|
||||
assertThrows(Exception.class, () -> hotel.cancelRoomBooking(1));
|
||||
}
|
||||
|
||||
|
||||
private static void deleteSchema(DataSource dataSource) throws java.sql.SQLException {
|
||||
try (var connection = dataSource.getConnection();
|
||||
var statement = connection.createStatement()) {
|
||||
var statement = connection.createStatement()) {
|
||||
statement.execute(RoomSchemaSql.DELETE_SCHEMA_SQL);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createSchema(DataSource dataSource) throws Exception {
|
||||
try (var connection = dataSource.getConnection();
|
||||
var statement = connection.createStatement()) {
|
||||
var statement = connection.createStatement()) {
|
||||
statement.execute(RoomSchemaSql.CREATE_SCHEMA_SQL);
|
||||
} catch (Exception e) {
|
||||
throw new Exception(e.getMessage(), e);
|
||||
@@ -150,4 +145,4 @@ class HotelTest {
|
||||
private int getNonExistingRoomId() {
|
||||
return 999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user