mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-19 01:26:35 +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:
@@ -40,9 +40,7 @@ package com.iluwatar.proxy;
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point.
|
||||
*/
|
||||
/** Program entry point. */
|
||||
public static void main(String[] args) {
|
||||
|
||||
var proxy = new WizardTowerProxy(new IvoryTower());
|
||||
@@ -51,6 +49,5 @@ public class App {
|
||||
proxy.enter(new Wizard("Black wizard"));
|
||||
proxy.enter(new Wizard("Green wizard"));
|
||||
proxy.enter(new Wizard("Brown wizard"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,14 +26,11 @@ package com.iluwatar.proxy;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* The object to be proxied.
|
||||
*/
|
||||
/** The object to be proxied. */
|
||||
@Slf4j
|
||||
public class IvoryTower implements WizardTower {
|
||||
|
||||
public void enter(Wizard wizard) {
|
||||
LOGGER.info("{} enters the tower.", wizard);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,9 +26,7 @@ package com.iluwatar.proxy;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Wizard.
|
||||
*/
|
||||
/** Wizard. */
|
||||
@RequiredArgsConstructor
|
||||
public class Wizard {
|
||||
|
||||
@@ -38,5 +36,4 @@ public class Wizard {
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
*/
|
||||
package com.iluwatar.proxy;
|
||||
|
||||
/**
|
||||
* WizardTower interface.
|
||||
*/
|
||||
/** WizardTower interface. */
|
||||
public interface WizardTower {
|
||||
|
||||
void enter(Wizard wizard);
|
||||
|
||||
@@ -26,9 +26,7 @@ package com.iluwatar.proxy;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* The proxy controlling access to the {@link IvoryTower}.
|
||||
*/
|
||||
/** The proxy controlling access to the {@link IvoryTower}. */
|
||||
@Slf4j
|
||||
public class WizardTowerProxy implements WizardTower {
|
||||
|
||||
|
||||
@@ -24,17 +24,15 @@
|
||||
*/
|
||||
package com.iluwatar.proxy;
|
||||
|
||||
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[] {}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,7 @@ import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests for {@link IvoryTower}
|
||||
*/
|
||||
/** Tests for {@link IvoryTower} */
|
||||
class IvoryTowerTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -52,12 +50,12 @@ class IvoryTowerTest {
|
||||
|
||||
@Test
|
||||
void testEnter() {
|
||||
final var wizards = List.of(
|
||||
new Wizard("Gandalf"),
|
||||
new Wizard("Dumbledore"),
|
||||
new Wizard("Oz"),
|
||||
new Wizard("Merlin")
|
||||
);
|
||||
final var wizards =
|
||||
List.of(
|
||||
new Wizard("Gandalf"),
|
||||
new Wizard("Dumbledore"),
|
||||
new Wizard("Oz"),
|
||||
new Wizard("Merlin"));
|
||||
|
||||
var tower = new IvoryTower();
|
||||
wizards.forEach(tower::enter);
|
||||
|
||||
@@ -29,9 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests for {@link Wizard}
|
||||
*/
|
||||
/** Tests for {@link Wizard} */
|
||||
class WizardTest {
|
||||
|
||||
@Test
|
||||
@@ -39,4 +37,4 @@ class WizardTest {
|
||||
List.of("Gandalf", "Dumbledore", "Oz", "Merlin")
|
||||
.forEach(name -> assertEquals(name, new Wizard(name).toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,7 @@ import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Tests for {@link WizardTowerProxy}
|
||||
*/
|
||||
/** Tests for {@link WizardTowerProxy} */
|
||||
class WizardTowerProxyTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -52,12 +50,12 @@ class WizardTowerProxyTest {
|
||||
|
||||
@Test
|
||||
void testEnter() {
|
||||
final var wizards = List.of(
|
||||
new Wizard("Gandalf"),
|
||||
new Wizard("Dumbledore"),
|
||||
new Wizard("Oz"),
|
||||
new Wizard("Merlin")
|
||||
);
|
||||
final var wizards =
|
||||
List.of(
|
||||
new Wizard("Gandalf"),
|
||||
new Wizard("Dumbledore"),
|
||||
new Wizard("Oz"),
|
||||
new Wizard("Merlin"));
|
||||
|
||||
final var proxy = new WizardTowerProxy(new IvoryTower());
|
||||
wizards.forEach(proxy::enter);
|
||||
|
||||
@@ -31,10 +31,7 @@ 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