📍Use lombok, reformat, and optimize the code (#1560)

* Use lombok, reformat, and optimize the code

* Fix merge conflicts and some sonar issues

Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
va1m
2021-03-13 13:19:21 +01:00
committed by GitHub
parent 0e26a6adb5
commit 5cf2fe009b
681 changed files with 2472 additions and 4966 deletions
@@ -23,19 +23,20 @@
package com.iluwatar.transactionscript;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import javax.sql.DataSource;
import org.h2.jdbcx.JdbcDataSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import javax.sql.DataSource;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
/**
* Tests {@link Hotel}
*/
public class HotelTest {
class HotelTest {
private static final String H2_DB_URL = "jdbc:h2:~/test";
@@ -54,20 +55,20 @@ public class HotelTest {
}
@Test
public void bookingRoomShouldChangeBookedStatusToTrue() throws Exception {
void bookingRoomShouldChangeBookedStatusToTrue() throws Exception {
hotel.bookRoom(1);
assertTrue(dao.getById(1).get().isBooked());
}
@Test()
public void bookingRoomWithInvalidIdShouldRaiseException() {
void bookingRoomWithInvalidIdShouldRaiseException() {
assertThrows(Exception.class, () -> {
hotel.bookRoom(getNonExistingRoomId());
});
}
@Test()
public void bookingRoomAgainShouldRaiseException() {
void bookingRoomAgainShouldRaiseException() {
assertThrows(Exception.class, () -> {
hotel.bookRoom(1);
hotel.bookRoom(1);
@@ -75,12 +76,12 @@ public class HotelTest {
}
@Test
public void NotBookingRoomShouldNotChangeBookedStatus() throws Exception {
void NotBookingRoomShouldNotChangeBookedStatus() throws Exception {
assertFalse(dao.getById(1).get().isBooked());
}
@Test
public void cancelRoomBookingShouldChangeBookedStatus() throws Exception {
void cancelRoomBookingShouldChangeBookedStatus() throws Exception {
hotel.bookRoom(1);
assertTrue(dao.getById(1).get().isBooked());
hotel.cancelRoomBooking(1);
@@ -88,14 +89,14 @@ public class HotelTest {
}
@Test
public void cancelRoomBookingWithInvalidIdShouldRaiseException() {
void cancelRoomBookingWithInvalidIdShouldRaiseException() {
assertThrows(Exception.class, () -> {
hotel.cancelRoomBooking(getNonExistingRoomId());
});
}
@Test
public void cancelRoomBookingForUnbookedRoomShouldRaiseException() {
void cancelRoomBookingForUnbookedRoomShouldRaiseException() {
assertThrows(Exception.class, () -> {
hotel.cancelRoomBooking(1);
});