mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 10:58:51 +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:
@@ -24,17 +24,15 @@
|
||||
*/
|
||||
package com.iluwatar.front.controller;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Application test */
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
void shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
assertDoesNotThrow(() -> App.main(new String[] {}));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -28,10 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* ApplicationExceptionTest
|
||||
*
|
||||
*/
|
||||
/** ApplicationExceptionTest */
|
||||
class ApplicationExceptionTest {
|
||||
|
||||
@Test
|
||||
@@ -39,5 +36,4 @@ class ApplicationExceptionTest {
|
||||
final var cause = new Exception();
|
||||
assertSame(cause, new ApplicationException(cause).getCause());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
/**
|
||||
* CommandTest
|
||||
*
|
||||
*/
|
||||
/** CommandTest */
|
||||
class CommandTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -53,14 +50,13 @@ class CommandTest {
|
||||
|
||||
static List<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{"Archer", "Displaying archers"},
|
||||
new Object[]{"Catapult", "Displaying catapults"},
|
||||
new Object[]{"NonExistentCommand", "Error 500"}
|
||||
);
|
||||
new Object[] {"Archer", "Displaying archers"},
|
||||
new Object[] {"Catapult", "Displaying catapults"},
|
||||
new Object[] {"NonExistentCommand", "Error 500"});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param request The request that's been tested
|
||||
* @param request The request that's been tested
|
||||
* @param displayMessage The expected display message
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@@ -72,5 +68,4 @@ class CommandTest {
|
||||
assertEquals(displayMessage, appender.getLastMessage());
|
||||
assertEquals(1, appender.getLogSize());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
*/
|
||||
package com.iluwatar.front.controller;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class DispatcherTest {
|
||||
|
||||
private Dispatcher dispatcher;
|
||||
|
||||
+5
-10
@@ -33,10 +33,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
/**
|
||||
* FrontControllerTest
|
||||
*
|
||||
*/
|
||||
/** FrontControllerTest */
|
||||
class FrontControllerTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -53,14 +50,13 @@ class FrontControllerTest {
|
||||
|
||||
static List<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{new ArcherCommand(), "Displaying archers"},
|
||||
new Object[]{new CatapultCommand(), "Displaying catapults"},
|
||||
new Object[]{new UnknownCommand(), "Error 500"}
|
||||
);
|
||||
new Object[] {new ArcherCommand(), "Displaying archers"},
|
||||
new Object[] {new CatapultCommand(), "Displaying catapults"},
|
||||
new Object[] {new UnknownCommand(), "Error 500"});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param command The command that's been tested
|
||||
* @param command The command that's been tested
|
||||
* @param displayMessage The expected display message
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@@ -71,5 +67,4 @@ class FrontControllerTest {
|
||||
assertEquals(displayMessage, appender.getLastMessage());
|
||||
assertEquals(1, appender.getLogSize());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,10 +33,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
/**
|
||||
* ViewTest
|
||||
*
|
||||
*/
|
||||
/** ViewTest */
|
||||
class ViewTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -53,14 +50,13 @@ class ViewTest {
|
||||
|
||||
static List<Object[]> dataProvider() {
|
||||
return List.of(
|
||||
new Object[]{new ArcherView(), "Displaying archers"},
|
||||
new Object[]{new CatapultView(), "Displaying catapults"},
|
||||
new Object[]{new ErrorView(), "Error 500"}
|
||||
);
|
||||
new Object[] {new ArcherView(), "Displaying archers"},
|
||||
new Object[] {new CatapultView(), "Displaying catapults"},
|
||||
new Object[] {new ErrorView(), "Error 500"});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param view The view that's been tested
|
||||
* @param view The view that's been tested
|
||||
* @param displayMessage The expected display message
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@@ -71,5 +67,4 @@ class ViewTest {
|
||||
assertEquals(displayMessage, appender.getLastMessage());
|
||||
assertEquals(1, appender.getLogSize());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-4
@@ -27,13 +27,11 @@ package com.iluwatar.front.controller.utils;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.AppenderBase;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* InMemory Log Appender Util.
|
||||
*/
|
||||
/** InMemory Log Appender Util. */
|
||||
public class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
|
||||
private final List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
||||
Reference in New Issue
Block a user