Update to JUnit5 across all modules (#1668)
* Updated saga to JUnit 5 * Update fix for CI job in trampoline module * Updated update-method module to JUnit 5 * Upgraded to latest JUnit Jupiter JUnit 4 is not needed when using JUnit-Vintage * Reverted change to access modifier on Trampoline * Cleanup to resolve code smells * Formatting * Formatting * Migrating to JUnit5 and updating some Mockito patterns * Migrating to JUnit5 * Migrating to JUnit5 * Migrating to JUnit 5 * Formatting cleanup * Added missing scope for junit * Fixed tests that were not running previously. Co-authored-by: Subhrodip Mohanta <hello@subho.xyz>
This commit is contained in:
@ -23,14 +23,13 @@
|
||||
|
||||
package com.iluwatar.tolerantreader;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
|
@ -25,26 +25,32 @@ package com.iluwatar.tolerantreader;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import org.junit.Rule;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
/**
|
||||
* Date: 12/30/15 - 18:39 PM
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
@EnableRuleMigrationSupport
|
||||
public class RainbowFishSerializerTest {
|
||||
|
||||
class RainbowFishSerializerTest {
|
||||
|
||||
/**
|
||||
* Create a temporary folder, used to generate files in during this test
|
||||
*/
|
||||
@Rule
|
||||
public final TemporaryFolder testFolder = new TemporaryFolder();
|
||||
@TempDir
|
||||
static Path testFolder;
|
||||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
assertTrue(Files.isDirectory(testFolder));
|
||||
}
|
||||
|
||||
/**
|
||||
* Rainbow fish version 1 used during the tests
|
||||
@ -60,11 +66,11 @@ public class RainbowFishSerializerTest {
|
||||
* Verify if a fish, written as version 1 can be read back as version 1
|
||||
*/
|
||||
@Test
|
||||
public void testWriteV1ReadV1() throws Exception {
|
||||
final var outputFile = this.testFolder.newFile();
|
||||
RainbowFishSerializer.writeV1(V1, outputFile.getPath());
|
||||
void testWriteV1ReadV1() throws Exception {
|
||||
final var outputPath = Files.createFile(testFolder.resolve("outputFile"));
|
||||
RainbowFishSerializer.writeV1(V1, outputPath.toString());
|
||||
|
||||
final var fish = RainbowFishSerializer.readV1(outputFile.getPath());
|
||||
final var fish = RainbowFishSerializer.readV1(outputPath.toString());
|
||||
assertNotSame(V1, fish);
|
||||
assertEquals(V1.getName(), fish.getName());
|
||||
assertEquals(V1.getAge(), fish.getAge());
|
||||
@ -77,11 +83,11 @@ public class RainbowFishSerializerTest {
|
||||
* Verify if a fish, written as version 2 can be read back as version 1
|
||||
*/
|
||||
@Test
|
||||
public void testWriteV2ReadV1() throws Exception {
|
||||
final var outputFile = this.testFolder.newFile();
|
||||
RainbowFishSerializer.writeV2(V2, outputFile.getPath());
|
||||
void testWriteV2ReadV1() throws Exception {
|
||||
final var outputPath = Files.createFile(testFolder.resolve("outputFile2"));
|
||||
RainbowFishSerializer.writeV2(V2, outputPath.toString());
|
||||
|
||||
final var fish = RainbowFishSerializer.readV1(outputFile.getPath());
|
||||
final var fish = RainbowFishSerializer.readV1(outputPath.toString());
|
||||
assertNotSame(V2, fish);
|
||||
assertEquals(V2.getName(), fish.getName());
|
||||
assertEquals(V2.getAge(), fish.getAge());
|
||||
@ -89,4 +95,4 @@ public class RainbowFishSerializerTest {
|
||||
assertEquals(V2.getWeightTons(), fish.getWeightTons());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,22 +23,22 @@
|
||||
|
||||
package com.iluwatar.tolerantreader;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Date: 12/30/15 - 18:34 PM
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class RainbowFishTest {
|
||||
class RainbowFishTest {
|
||||
|
||||
/**
|
||||
* Verify if the getters of a {@link RainbowFish} return the expected values
|
||||
*/
|
||||
@Test
|
||||
public void testValues() {
|
||||
void testValues() {
|
||||
final var fish = new RainbowFish("name", 1, 2, 3);
|
||||
assertEquals("name", fish.getName());
|
||||
assertEquals(1, fish.getAge());
|
||||
|
@ -27,20 +27,20 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Date: 12/30/15 - 18:35 PM
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class RainbowFishV2Test {
|
||||
class RainbowFishV2Test {
|
||||
|
||||
/**
|
||||
* Verify if the getters of a {@link RainbowFish} return the expected values
|
||||
*/
|
||||
@Test
|
||||
public void testValues() {
|
||||
void testValues() {
|
||||
final var fish = new RainbowFishV2("name", 1, 2, 3, false, true, false);
|
||||
assertEquals("name", fish.getName());
|
||||
assertEquals(1, fish.getAge());
|
||||
|
Reference in New Issue
Block a user