refactor: remove code smell java:S5786 (#2159)

https://sonarcloud.io/organizations/iluwatar/rules?open=java%3AS5786&rule_key=java%3AS5786
This commit is contained in:
Robert Volkmann
2022-10-30 17:21:21 +01:00
committed by GitHub
parent 5afc32cf23
commit 4cd8149502
155 changed files with 273 additions and 273 deletions
@@ -47,7 +47,7 @@ import org.mockito.Mockito;
/**
* Tests {@link HotelDaoImpl}.
*/
public class HotelDaoImplTest {
class HotelDaoImplTest {
private static final String DB_URL = "jdbc:h2:~/test";
private HotelDaoImpl dao;
@@ -59,7 +59,7 @@ public class HotelDaoImplTest {
* @throws SQLException if there is any error while creating schema.
*/
@BeforeEach
public void createSchema() throws SQLException {
void createSchema() throws SQLException {
try (var connection = DriverManager.getConnection(DB_URL);
var statement = connection.createStatement()) {
statement.execute(RoomSchemaSql.DELETE_SCHEMA_SQL);
@@ -71,7 +71,7 @@ public class HotelDaoImplTest {
* Represents the scenario where DB connectivity is present.
*/
@Nested
public class ConnectionSuccess {
class ConnectionSuccess {
/**
* Setup for connection success scenario.
@@ -79,7 +79,7 @@ public class HotelDaoImplTest {
* @throws Exception if any error occurs.
*/
@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
var dataSource = new JdbcDataSource();
dataSource.setURL(DB_URL);
dao = new HotelDaoImpl(dataSource);
@@ -91,7 +91,7 @@ public class HotelDaoImplTest {
* Represents the scenario when DAO operations are being performed on a non existing room.
*/
@Nested
public class NonExistingRoom {
class NonExistingRoom {
@Test
void addingShouldResultInSuccess() throws Exception {
@@ -139,7 +139,7 @@ public class HotelDaoImplTest {
* room.
*/
@Nested
public class ExistingRoom {
class ExistingRoom {
@Test
void addingShouldResultInFailureAndNotAffectExistingRooms() throws Exception {
@@ -184,7 +184,7 @@ public class HotelDaoImplTest {
* unavailable.
*/
@Nested
public class ConnectivityIssue {
class ConnectivityIssue {
private static final String EXCEPTION_CAUSE = "Connection not available";
@@ -194,7 +194,7 @@ public class HotelDaoImplTest {
* @throws SQLException if any error occurs.
*/
@BeforeEach
public void setUp() throws SQLException {
void setUp() throws SQLException {
dao = new HotelDaoImpl(mockedDatasource());
}
@@ -253,7 +253,7 @@ public class HotelDaoImplTest {
* @throws SQLException if any error occurs.
*/
@AfterEach
public void deleteSchema() throws SQLException {
void deleteSchema() throws SQLException {
try (var connection = DriverManager.getConnection(DB_URL);
var statement = connection.createStatement()) {
statement.execute(RoomSchemaSql.DELETE_SCHEMA_SQL);
@@ -45,7 +45,7 @@ class HotelTest {
private HotelDaoImpl dao;
@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
final var dataSource = createDataSource();
deleteSchema(dataSource);
createSchema(dataSource);