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:
Ilkka Seppälä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14408 additions and 17637 deletions
@@ -24,23 +24,19 @@
*/
package com.iluwatar.dao;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
/**
* Tests that DAO example runs without errors.
*/
import org.junit.jupiter.api.Test;
/** Tests that DAO example runs without errors. */
class AppTest {
/**
* Issue: Add at least one assertion to this test case.
* Solution: Inserted assertion to check whether the execution of the main method in {@link App#main(String[])}
* throws an exception.
* Issue: Add at least one assertion to this test case. Solution: Inserted assertion to check
* whether the execution of the main method in {@link App#main(String[])} throws an exception.
*/
@Test
void shouldExecuteDaoWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
assertDoesNotThrow(() -> App.main(new String[] {}));
}
}
@@ -30,9 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Tests {@link Customer}.
*/
/** Tests {@link Customer}. */
class CustomerTest {
private Customer customer;
@@ -89,7 +87,10 @@ class CustomerTest {
@Test
void testToString() {
assertEquals(String.format("Customer(id=%s, firstName=%s, lastName=%s)",
customer.getId(), customer.getFirstName(), customer.getLastName()), customer.toString());
assertEquals(
String.format(
"Customer(id=%s, firstName=%s, lastName=%s)",
customer.getId(), customer.getFirstName(), customer.getLastName()),
customer.toString());
}
}
@@ -44,9 +44,7 @@ import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
/**
* Tests {@link DbCustomerDao}.
*/
/** Tests {@link DbCustomerDao}. */
class DbCustomerDaoTest {
private static final String DB_URL = "jdbc:h2:mem:dao;DB_CLOSE_DELAY=-1";
@@ -61,14 +59,12 @@ class DbCustomerDaoTest {
@BeforeEach
void createSchema() throws SQLException {
try (var connection = DriverManager.getConnection(DB_URL);
var statement = connection.createStatement()) {
var statement = connection.createStatement()) {
statement.execute(CustomerSchemaSql.CREATE_SCHEMA_SQL);
}
}
/**
* Represents the scenario where DB connectivity is present.
*/
/** Represents the scenario where DB connectivity is present. */
@Nested
class ConnectionSuccess {
@@ -160,8 +156,8 @@ class DbCustomerDaoTest {
}
@Test
void updationShouldBeSuccessAndAccessingTheSameCustomerShouldReturnUpdatedInformation() throws
Exception {
void updationShouldBeSuccessAndAccessingTheSameCustomerShouldReturnUpdatedInformation()
throws Exception {
final var newFirstname = "Bernard";
final var newLastname = "Montgomery";
final var customer = new Customer(existingCustomer.getId(), newFirstname, newLastname);
@@ -218,7 +214,9 @@ class DbCustomerDaoTest {
void updatingACustomerFailsWithFeedbackToTheClient() {
final var newFirstname = "Bernard";
final var newLastname = "Montgomery";
assertThrows(Exception.class, () -> dao.update(new Customer(existingCustomer.getId(), newFirstname, newLastname)));
assertThrows(
Exception.class,
() -> dao.update(new Customer(existingCustomer.getId(), newFirstname, newLastname)));
}
@Test
@@ -230,7 +228,6 @@ class DbCustomerDaoTest {
void retrievingAllCustomersFailsWithExceptionAsFeedbackToClient() {
assertThrows(Exception.class, () -> dao.getAll());
}
}
/**
@@ -241,7 +238,7 @@ class DbCustomerDaoTest {
@AfterEach
void deleteSchema() throws SQLException {
try (var connection = DriverManager.getConnection(DB_URL);
var statement = connection.createStatement()) {
var statement = connection.createStatement()) {
statement.execute(CustomerSchemaSql.DELETE_SCHEMA_SQL);
}
}
@@ -33,9 +33,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
/**
* Tests {@link InMemoryCustomerDao}.
*/
/** Tests {@link InMemoryCustomerDao}. */
class InMemoryCustomerDaoTest {
private InMemoryCustomerDao dao;
@@ -48,8 +46,7 @@ class InMemoryCustomerDaoTest {
}
/**
* Represents the scenario when the DAO operations are being performed on a non-existent
* customer.
* Represents the scenario when the DAO operations are being performed on a non-existent customer.
*/
@Nested
class NonExistingCustomer {
@@ -121,8 +118,8 @@ class InMemoryCustomerDaoTest {
}
@Test
void updationShouldBeSuccessAndAccessingTheSameCustomerShouldReturnUpdatedInformation() throws
Exception {
void updationShouldBeSuccessAndAccessingTheSameCustomerShouldReturnUpdatedInformation()
throws Exception {
final var newFirstname = "Bernard";
final var newLastname = "Montgomery";
final var customer = new Customer(CUSTOMER.getId(), newFirstname, newLastname);