mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 20:59:29 +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:
@@ -31,14 +31,12 @@ import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
/** Application test */
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
void shouldExecuteWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
assertDoesNotThrow(() -> App.main(new String[] {}));
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
|
||||
+7
-24
@@ -34,37 +34,24 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
/**
|
||||
* RainbowFishSerializerTest
|
||||
*
|
||||
*/
|
||||
|
||||
/** RainbowFishSerializerTest */
|
||||
class RainbowFishSerializerTest {
|
||||
|
||||
/**
|
||||
* Create a temporary folder, used to generate files in during this test
|
||||
*/
|
||||
@TempDir
|
||||
static Path testFolder;
|
||||
/** Create a temporary folder, used to generate files in during this test */
|
||||
@TempDir static Path testFolder;
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
assertTrue(Files.isDirectory(testFolder));
|
||||
}
|
||||
|
||||
/**
|
||||
* Rainbow fish version 1 used during the tests
|
||||
*/
|
||||
/** Rainbow fish version 1 used during the tests */
|
||||
private static final RainbowFish V1 = new RainbowFish("version1", 1, 2, 3);
|
||||
|
||||
/**
|
||||
* Rainbow fish version 2 used during the tests
|
||||
*/
|
||||
/** Rainbow fish version 2 used during the tests */
|
||||
private static final RainbowFishV2 V2 = new RainbowFishV2("version2", 4, 5, 6, true, false, true);
|
||||
|
||||
/**
|
||||
* Verify if a fish, written as version 1 can be read back as version 1
|
||||
*/
|
||||
/** Verify if a fish, written as version 1 can be read back as version 1 */
|
||||
@Test
|
||||
void testWriteV1ReadV1() throws Exception {
|
||||
final var outputPath = Files.createFile(testFolder.resolve("outputFile"));
|
||||
@@ -76,12 +63,9 @@ class RainbowFishSerializerTest {
|
||||
assertEquals(V1.getAge(), fish.getAge());
|
||||
assertEquals(V1.getLengthMeters(), fish.getLengthMeters());
|
||||
assertEquals(V1.getWeightTons(), fish.getWeightTons());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if a fish, written as version 2 can be read back as version 1
|
||||
*/
|
||||
/** Verify if a fish, written as version 2 can be read back as version 1 */
|
||||
@Test
|
||||
void testWriteV2ReadV1() throws Exception {
|
||||
final var outputPath = Files.createFile(testFolder.resolve("outputFile2"));
|
||||
@@ -94,5 +78,4 @@ class RainbowFishSerializerTest {
|
||||
assertEquals(V2.getLengthMeters(), fish.getLengthMeters());
|
||||
assertEquals(V2.getWeightTons(), fish.getWeightTons());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,15 +28,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* RainbowFishTest
|
||||
*
|
||||
*/
|
||||
/** RainbowFishTest */
|
||||
class RainbowFishTest {
|
||||
|
||||
/**
|
||||
* Verify if the getters of a {@link RainbowFish} return the expected values
|
||||
*/
|
||||
/** Verify if the getters of a {@link RainbowFish} return the expected values */
|
||||
@Test
|
||||
void testValues() {
|
||||
final var fish = new RainbowFish("name", 1, 2, 3);
|
||||
@@ -45,5 +40,4 @@ class RainbowFishTest {
|
||||
assertEquals(2, fish.getLengthMeters());
|
||||
assertEquals(3, fish.getWeightTons());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,15 +30,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* RainbowFishV2Test
|
||||
*
|
||||
*/
|
||||
/** RainbowFishV2Test */
|
||||
class RainbowFishV2Test {
|
||||
|
||||
/**
|
||||
* Verify if the getters of a {@link RainbowFish} return the expected values
|
||||
*/
|
||||
/** Verify if the getters of a {@link RainbowFish} return the expected values */
|
||||
@Test
|
||||
void testValues() {
|
||||
final var fish = new RainbowFishV2("name", 1, 2, 3, false, true, false);
|
||||
@@ -50,5 +45,4 @@ class RainbowFishV2Test {
|
||||
assertTrue(fish.isHungry());
|
||||
assertFalse(fish.isAngry());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user