mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 16:59:24 +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.privateclassdata;
|
||||
|
||||
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[] {}));
|
||||
}
|
||||
}
|
||||
|
||||
+9
-14
@@ -31,10 +31,7 @@ import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* ImmutableStewTest
|
||||
*
|
||||
*/
|
||||
/** ImmutableStewTest */
|
||||
class ImmutableStewTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -49,9 +46,7 @@ class ImmutableStewTest {
|
||||
appender.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if mixing the stew doesn't change the internal state
|
||||
*/
|
||||
/** Verify if mixing the stew doesn't change the internal state */
|
||||
@Test
|
||||
void testMix() {
|
||||
var stew = new Stew(1, 2, 3, 4);
|
||||
@@ -65,22 +60,22 @@ class ImmutableStewTest {
|
||||
assertEquals(20, appender.getLogSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if tasting the stew actually removes one of each ingredient
|
||||
*/
|
||||
/** Verify if tasting the stew actually removes one of each ingredient */
|
||||
@Test
|
||||
void testDrink() {
|
||||
final var stew = new Stew(1, 2, 3, 4);
|
||||
stew.mix();
|
||||
|
||||
assertEquals("Mixing the stew we find: 1 potatoes, 2 carrots, 3 meat and 4 peppers", appender
|
||||
.getLastMessage());
|
||||
assertEquals(
|
||||
"Mixing the stew we find: 1 potatoes, 2 carrots, 3 meat and 4 peppers",
|
||||
appender.getLastMessage());
|
||||
|
||||
stew.taste();
|
||||
assertEquals("Tasting the stew", appender.getLastMessage());
|
||||
|
||||
stew.mix();
|
||||
assertEquals("Mixing the stew we find: 0 potatoes, 1 carrots, 2 meat and 3 peppers", appender
|
||||
.getLastMessage());
|
||||
assertEquals(
|
||||
"Mixing the stew we find: 0 potatoes, 1 carrots, 2 meat and 3 peppers",
|
||||
appender.getLastMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,7 @@ import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* StewTest
|
||||
*
|
||||
*/
|
||||
/** StewTest */
|
||||
class StewTest {
|
||||
|
||||
private InMemoryAppender appender;
|
||||
@@ -49,14 +46,12 @@ class StewTest {
|
||||
appender.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if mixing the stew doesn't change the internal state
|
||||
*/
|
||||
/** Verify if mixing the stew doesn't change the internal state */
|
||||
@Test
|
||||
void testMix() {
|
||||
final var stew = new ImmutableStew(1, 2, 3, 4);
|
||||
final var expectedMessage = "Mixing the immutable stew we find: 1 potatoes, "
|
||||
+ "2 carrots, 3 meat and 4 peppers";
|
||||
final var expectedMessage =
|
||||
"Mixing the immutable stew we find: 1 potatoes, " + "2 carrots, 3 meat and 4 peppers";
|
||||
|
||||
for (var i = 0; i < 20; i++) {
|
||||
stew.mix();
|
||||
@@ -65,5 +60,4 @@ class StewTest {
|
||||
|
||||
assertEquals(20, appender.getLogSize());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-3
@@ -31,9 +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