mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-09-15 14:19:46 +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:
@@ -60,5 +60,4 @@ public class App {
|
||||
canonPrinterController.print(MESSAGE_TO_PRINT);
|
||||
epsonPrinterController.print(MESSAGE_TO_PRINT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,12 +36,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
public class CanonPrinter implements Printer {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void print(String message) {
|
||||
LOGGER.info("Canon Printer : {}", message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,20 +28,17 @@ import com.iluwatar.delegation.simple.Printer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Specialised Implementation of {@link Printer} for an Epson Printer, in this case the message to be
|
||||
* printed is appended to "Epson Printer : ".
|
||||
* Specialised Implementation of {@link Printer} for an Epson Printer, in this case the message to
|
||||
* be printed is appended to "Epson Printer : ".
|
||||
*
|
||||
* @see Printer
|
||||
*/
|
||||
@Slf4j
|
||||
public class EpsonPrinter implements Printer {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void print(String message) {
|
||||
LOGGER.info("Epson Printer : {}", message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,12 +36,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
public class HpPrinter implements Printer {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void print(String message) {
|
||||
LOGGER.info("HP Printer : {}", message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,24 +24,19 @@
|
||||
*/
|
||||
package com.iluwatar.delegation.simple;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application Test Entry
|
||||
*/
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Application Test Entry */
|
||||
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 shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
assertDoesNotThrow(() -> App.main(new String[] {}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Test for Delegation Pattern
|
||||
*/
|
||||
/** Test for Delegation Pattern */
|
||||
class DelegateTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -82,9 +80,7 @@ class DelegateTest {
|
||||
assertEquals("Epson Printer : Test Message Printed", appender.getLastMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging Appender
|
||||
*/
|
||||
/** Logging Appender */
|
||||
private static class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
|
||||
private final List<ILoggingEvent> log = new LinkedList<>();
|
||||
@@ -107,5 +103,4 @@ class DelegateTest {
|
||||
return log.size();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user