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
@@ -45,5 +45,4 @@ class LayersAppTests {
void contextLoads() {
assertNotNull(applicationContext);
}
}
@@ -38,9 +38,9 @@ import java.util.Set;
import org.junit.jupiter.api.Test;
/**
* This class contains unit tests for the Cake class.
* It tests the functionality of setting and getting the id, topping, and layers of a Cake object.
* It also tests the functionality of adding a layer to a Cake object and converting a Cake object to a string.
* This class contains unit tests for the Cake class. It tests the functionality of setting and
* getting the id, topping, and layers of a Cake object. It also tests the functionality of adding a
* layer to a Cake object and converting a Cake object to a string.
*/
class CakeTest {
@@ -70,8 +70,11 @@ class CakeTest {
assertNotNull(cake.getLayers());
assertTrue(cake.getLayers().isEmpty());
final var expectedLayers = Set.of(new CakeLayer("layer1", 1000), new CakeLayer("layer2", 2000),
new CakeLayer("layer3", 3000));
final var expectedLayers =
Set.of(
new CakeLayer("layer1", 1000),
new CakeLayer("layer2", 2000),
new CakeLayer("layer3", 3000));
cake.setLayers(expectedLayers);
assertEquals(expectedLayers, cake.getLayers());
}
@@ -112,10 +115,9 @@ class CakeTest {
cake.setTopping(topping);
cake.addLayer(layer);
final var expected = "id=1234 topping=id=2345 name=topping calories=20 "
+ "layers=[id=3456 name=layer calories=100]";
final var expected =
"id=1234 topping=id=2345 name=topping calories=20 "
+ "layers=[id=3456 name=layer calories=100]";
assertEquals(expected, cake.toString());
}
}
@@ -32,17 +32,15 @@ import exception.CakeBakingException;
import org.junit.jupiter.api.Test;
/**
* Tests for the {@link CakeBakingException} class.
* This class contains unit tests to verify the correct functionality
* of the {@code CakeBakingException} class constructors, including the default constructor
* and the constructor that accepts a message parameter.
* Tests for the {@link CakeBakingException} class. This class contains unit tests to verify the
* correct functionality of the {@code CakeBakingException} class constructors, including the
* default constructor and the constructor that accepts a message parameter.
*/
class CakeBakingExceptionTest {
/**
* Tests the default constructor of {@link CakeBakingException}.
* Ensures that an exception created with the default constructor has
* {@code null} as its message and cause.
* Tests the default constructor of {@link CakeBakingException}. Ensures that an exception created
* with the default constructor has {@code null} as its message and cause.
*/
@Test
void testConstructor() {
@@ -52,18 +50,20 @@ class CakeBakingExceptionTest {
}
/**
* Tests the constructor of {@link CakeBakingException} that accepts a message.
* Ensures that an exception created with this constructor correctly stores the provided message
* and has {@code null} as its cause.
* Tests the constructor of {@link CakeBakingException} that accepts a message. Ensures that an
* exception created with this constructor correctly stores the provided message and has {@code
* null} as its cause.
*/
@Test
void testConstructorWithMessage() {
final var expectedMessage = "message";
final var exception = new CakeBakingException(expectedMessage);
assertEquals(expectedMessage, exception.getMessage(),
assertEquals(
expectedMessage,
exception.getMessage(),
"The stored message should match the expected message.");
assertNull(exception.getCause(),
assertNull(
exception.getCause(),
"The cause should be null when an exception is created with only a message.");
}
}
@@ -44,10 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import service.CakeBakingServiceImpl;
/**
* Constructs a new instance of CakeBakingServiceImplTest.
*
*/
/** Constructs a new instance of CakeBakingServiceImplTest. */
@SpringBootTest(classes = LayersApp.class)
class CakeBakingServiceImplTest {
@@ -65,7 +62,6 @@ class CakeBakingServiceImplTest {
cakeBakingService.deleteAllToppings();
}
@Test
void testLayers() {
final var initialLayers = cakeBakingService.getAvailableLayers();
@@ -84,7 +80,6 @@ class CakeBakingServiceImplTest {
assertNotNull(layer.toString());
assertTrue(layer.calories > 0);
}
}
@Test
@@ -105,7 +100,6 @@ class CakeBakingServiceImplTest {
assertNotNull(topping.toString());
assertTrue(topping.calories > 0);
}
}
@Test
@@ -141,7 +135,6 @@ class CakeBakingServiceImplTest {
assertFalse(cakeInfo.cakeLayerInfos.isEmpty());
assertTrue(cakeInfo.calculateTotalCalories() > 0);
}
}
@Test
@@ -152,7 +145,8 @@ class CakeBakingServiceImplTest {
cakeBakingService.saveNewLayer(layer2);
final var missingTopping = new CakeToppingInfo("Topping1", 1000);
assertThrows(CakeBakingException.class,
assertThrows(
CakeBakingException.class,
() -> cakeBakingService.bakeNewCake(new CakeInfo(missingTopping, List.of(layer1, layer2))));
}
@@ -169,7 +163,8 @@ class CakeBakingServiceImplTest {
cakeBakingService.saveNewLayer(layer1);
final var missingLayer = new CakeLayerInfo("Layer2", 2000);
assertThrows(CakeBakingException.class,
assertThrows(
CakeBakingException.class,
() -> cakeBakingService.bakeNewCake(new CakeInfo(topping1, List.of(layer1, missingLayer))));
}
@@ -190,8 +185,10 @@ class CakeBakingServiceImplTest {
cakeBakingService.saveNewLayer(layer2);
cakeBakingService.bakeNewCake(new CakeInfo(topping1, List.of(layer1, layer2)));
assertThrows(CakeBakingException.class, () -> cakeBakingService.bakeNewCake(
new CakeInfo(topping2, Collections.singletonList(layer2))));
assertThrows(
CakeBakingException.class,
() ->
cakeBakingService.bakeNewCake(
new CakeInfo(topping2, Collections.singletonList(layer2))));
}
}
@@ -45,9 +45,9 @@ import service.CakeBakingService;
import view.CakeViewImpl;
/**
* This class contains unit tests for the CakeViewImpl class.
* It tests the functionality of rendering cakes using the CakeViewImpl class.
* It also tests the logging functionality of the CakeViewImpl class.
* This class contains unit tests for the CakeViewImpl class. It tests the functionality of
* rendering cakes using the CakeViewImpl class. It also tests the logging functionality of the
* CakeViewImpl class.
*/
class CakeViewImplTest {
@@ -63,14 +63,15 @@ class CakeViewImplTest {
appender.stop();
}
/**
* Verify if the cake view renders the expected result.
*/
/** Verify if the cake view renders the expected result. */
@Test
void testRender() {
final var layers = List.of(new CakeLayerInfo("layer1", 1000), new CakeLayerInfo("layer2", 2000),
new CakeLayerInfo("layer3", 3000));
final var layers =
List.of(
new CakeLayerInfo("layer1", 1000),
new CakeLayerInfo("layer2", 2000),
new CakeLayerInfo("layer3", 3000));
final var cake = new CakeInfo(new CakeToppingInfo("topping", 1000), layers);
final var cakes = List.of(cake);
@@ -84,7 +85,6 @@ class CakeViewImplTest {
cakeView.render();
assertEquals(cake.toString(), appender.getLastMessage());
}
private static class InMemoryAppender extends AppenderBase<ILoggingEvent> {
@@ -109,5 +109,4 @@ class CakeViewImplTest {
return log.size();
}
}
}