mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 18:59: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:
@@ -26,9 +26,7 @@ package com.iluwatar.model.view.controller;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* Fatigue enumeration.
|
||||
*/
|
||||
/** Fatigue enumeration. */
|
||||
@AllArgsConstructor
|
||||
public enum Fatigue {
|
||||
ALERT("alert"),
|
||||
@@ -37,7 +35,6 @@ public enum Fatigue {
|
||||
|
||||
private final String title;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return title;
|
||||
|
||||
+1
-3
@@ -24,9 +24,7 @@
|
||||
*/
|
||||
package com.iluwatar.model.view.controller;
|
||||
|
||||
/**
|
||||
* GiantController can update the giant data and redraw it using the view.
|
||||
*/
|
||||
/** GiantController can update the giant data and redraw it using the view. */
|
||||
public class GiantController {
|
||||
|
||||
private final GiantModel giant;
|
||||
|
||||
+1
-4
@@ -30,9 +30,7 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* GiantModel contains the giant data.
|
||||
*/
|
||||
/** GiantModel contains the giant data. */
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -44,7 +42,6 @@ public class GiantModel {
|
||||
private Fatigue fatigue;
|
||||
private Nourishment nourishment;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("The giant looks %s, %s and %s.", health, fatigue, nourishment);
|
||||
|
||||
+1
-3
@@ -26,9 +26,7 @@ package com.iluwatar.model.view.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* GiantView displays the giant.
|
||||
*/
|
||||
/** GiantView displays the giant. */
|
||||
@Slf4j
|
||||
public class GiantView {
|
||||
|
||||
|
||||
@@ -26,9 +26,7 @@ package com.iluwatar.model.view.controller;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* Health enumeration.
|
||||
*/
|
||||
/** Health enumeration. */
|
||||
@AllArgsConstructor
|
||||
public enum Health {
|
||||
HEALTHY("healthy"),
|
||||
@@ -37,7 +35,6 @@ public enum Health {
|
||||
|
||||
private final String title;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return title;
|
||||
|
||||
+1
-4
@@ -26,9 +26,7 @@ package com.iluwatar.model.view.controller;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* Nourishment enumeration.
|
||||
*/
|
||||
/** Nourishment enumeration. */
|
||||
@AllArgsConstructor
|
||||
public enum Nourishment {
|
||||
SATURATED("saturated"),
|
||||
@@ -37,7 +35,6 @@ public enum Nourishment {
|
||||
|
||||
private final String title;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return title;
|
||||
|
||||
@@ -24,17 +24,15 @@
|
||||
*/
|
||||
package com.iluwatar.model.view.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[] {}));
|
||||
}
|
||||
}
|
||||
|
||||
+5
-15
@@ -30,15 +30,10 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* GiantControllerTest
|
||||
*
|
||||
*/
|
||||
/** GiantControllerTest */
|
||||
class GiantControllerTest {
|
||||
|
||||
/**
|
||||
* Verify if the controller passes the health level through to the model and vice versa
|
||||
*/
|
||||
/** Verify if the controller passes the health level through to the model and vice versa */
|
||||
@Test
|
||||
void testSetHealth() {
|
||||
final var model = mock(GiantModel.class);
|
||||
@@ -60,9 +55,7 @@ class GiantControllerTest {
|
||||
verifyNoMoreInteractions(model, view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the controller passes the fatigue level through to the model and vice versa
|
||||
*/
|
||||
/** Verify if the controller passes the fatigue level through to the model and vice versa */
|
||||
@Test
|
||||
void testSetFatigue() {
|
||||
final var model = mock(GiantModel.class);
|
||||
@@ -84,9 +77,7 @@ class GiantControllerTest {
|
||||
verifyNoMoreInteractions(model, view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the controller passes the nourishment level through to the model and vice versa
|
||||
*/
|
||||
/** Verify if the controller passes the nourishment level through to the model and vice versa */
|
||||
@Test
|
||||
void testSetNourishment() {
|
||||
final var model = mock(GiantModel.class);
|
||||
@@ -121,5 +112,4 @@ class GiantControllerTest {
|
||||
|
||||
verifyNoMoreInteractions(model, view);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+4
-14
@@ -28,15 +28,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* GiantModelTest
|
||||
*
|
||||
*/
|
||||
/** GiantModelTest */
|
||||
class GiantModelTest {
|
||||
|
||||
/**
|
||||
* Verify if the health value is set properly though the constructor and setter
|
||||
*/
|
||||
/** Verify if the health value is set properly though the constructor and setter */
|
||||
@Test
|
||||
void testSetHealth() {
|
||||
final var model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
|
||||
@@ -49,9 +44,7 @@ class GiantModelTest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the fatigue level is set properly though the constructor and setter
|
||||
*/
|
||||
/** Verify if the fatigue level is set properly though the constructor and setter */
|
||||
@Test
|
||||
void testSetFatigue() {
|
||||
final var model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
|
||||
@@ -64,9 +57,7 @@ class GiantModelTest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the nourishment level is set properly though the constructor and setter
|
||||
*/
|
||||
/** Verify if the nourishment level is set properly though the constructor and setter */
|
||||
@Test
|
||||
void testSetNourishment() {
|
||||
final var model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
|
||||
@@ -78,5 +69,4 @@ class GiantModelTest {
|
||||
assertEquals(String.format(messageFormat, nourishment), model.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-7
@@ -37,10 +37,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* GiantViewTest
|
||||
*
|
||||
*/
|
||||
/** GiantViewTest */
|
||||
class GiantViewTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -70,9 +67,7 @@ class GiantViewTest {
|
||||
assertEquals(1, appender.getLogSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging Appender Implementation
|
||||
*/
|
||||
/** Logging Appender Implementation */
|
||||
public static class InMemoryAppender extends AppenderBase<ILoggingEvent> {
|
||||
private final List<ILoggingEvent> log = new LinkedList<>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user