mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-30 06:21:15 +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:
@@ -31,9 +31,7 @@ import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests that Collection Pipeline methods work as expected.
|
||||
*/
|
||||
/** Tests that Collection Pipeline methods work as expected. */
|
||||
@Slf4j
|
||||
class AppTest {
|
||||
|
||||
@@ -53,19 +51,20 @@ class AppTest {
|
||||
|
||||
@Test
|
||||
void testGetGroupingOfCarsByCategory() {
|
||||
var modelsExpected = Map.of(
|
||||
Category.CONVERTIBLE, List.of(
|
||||
new Car("Buick", "Cascada", 2016, Category.CONVERTIBLE),
|
||||
new Car("Chevrolet", "Geo Metro", 1992, Category.CONVERTIBLE)
|
||||
),
|
||||
Category.SEDAN, List.of(
|
||||
new Car("Dodge", "Avenger", 2010, Category.SEDAN),
|
||||
new Car("Ford", "Focus", 2012, Category.SEDAN)
|
||||
),
|
||||
Category.JEEP, List.of(
|
||||
new Car("Jeep", "Wrangler", 2011, Category.JEEP),
|
||||
new Car("Jeep", "Comanche", 1990, Category.JEEP))
|
||||
);
|
||||
var modelsExpected =
|
||||
Map.of(
|
||||
Category.CONVERTIBLE,
|
||||
List.of(
|
||||
new Car("Buick", "Cascada", 2016, Category.CONVERTIBLE),
|
||||
new Car("Chevrolet", "Geo Metro", 1992, Category.CONVERTIBLE)),
|
||||
Category.SEDAN,
|
||||
List.of(
|
||||
new Car("Dodge", "Avenger", 2010, Category.SEDAN),
|
||||
new Car("Ford", "Focus", 2012, Category.SEDAN)),
|
||||
Category.JEEP,
|
||||
List.of(
|
||||
new Car("Jeep", "Wrangler", 2011, Category.JEEP),
|
||||
new Car("Jeep", "Comanche", 1990, Category.JEEP)));
|
||||
var modelsFunctional = FunctionalProgramming.getGroupingOfCarsByCategory(cars);
|
||||
var modelsImperative = ImperativeProgramming.getGroupingOfCarsByCategory(cars);
|
||||
LOGGER.info("Category " + modelsFunctional);
|
||||
@@ -76,10 +75,10 @@ class AppTest {
|
||||
@Test
|
||||
void testGetSedanCarsOwnedSortedByDate() {
|
||||
var john = new Person(cars);
|
||||
var modelsExpected = List.of(
|
||||
new Car("Dodge", "Avenger", 2010, Category.SEDAN),
|
||||
new Car("Ford", "Focus", 2012, Category.SEDAN)
|
||||
);
|
||||
var modelsExpected =
|
||||
List.of(
|
||||
new Car("Dodge", "Avenger", 2010, Category.SEDAN),
|
||||
new Car("Ford", "Focus", 2012, Category.SEDAN));
|
||||
var modelsFunctional = FunctionalProgramming.getSedanCarsOwnedSortedByDate(List.of(john));
|
||||
var modelsImperative = ImperativeProgramming.getSedanCarsOwnedSortedByDate(List.of(john));
|
||||
assertEquals(modelsExpected, modelsFunctional);
|
||||
|
||||
Reference in New Issue
Block a user