Resolves checkstyle errors for collection-pipeline, command, commander (#1061)
* Reduces checkstyle errors in collection-pipeline * Reduces checkstyle errors in command * Reduces checkstyle errors in commander
This commit is contained in:
committed by
Ilkka Seppälä
parent
31f27a720b
commit
2f49648047
@ -23,14 +23,13 @@
|
||||
|
||||
package com.iluwatar.collectionpipeline;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Tests that Collection Pipeline methods work as expected.
|
||||
@ -39,35 +38,35 @@ public class AppTest {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AppTest.class);
|
||||
|
||||
private List<Car> cars = CarFactory.createCars();
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetModelsAfter2000UsingFor() {
|
||||
var models = ImperativeProgramming.getModelsAfter2000(cars);
|
||||
assertEquals(List.of("Avenger", "Wrangler", "Focus", "Cascada"), models);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetModelsAfter2000UsingPipeline() {
|
||||
var models = FunctionalProgramming.getModelsAfter2000(cars);
|
||||
assertEquals(List.of("Avenger", "Wrangler", "Focus", "Cascada"), models);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public 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)));
|
||||
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);
|
||||
assertEquals(modelsExpected, modelsFunctional);
|
||||
assertEquals(modelsExpected, modelsImperative);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetSedanCarsOwnedSortedByDate() {
|
||||
var john = new Person(cars);
|
||||
|
Reference in New Issue
Block a user