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:
@ -36,10 +36,6 @@
|
||||
<artifactId>subclass-sandbox</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.stefanbirkner</groupId>
|
||||
<artifactId>system-lambda</artifactId>
|
||||
|
@ -23,17 +23,17 @@
|
||||
|
||||
package com.iluwatar.subclasssandbox;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* App unit tests.
|
||||
*/
|
||||
public class AppTest {
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
public void shouldExecuteWithoutException() {
|
||||
void shouldExecuteWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
}
|
||||
}
|
||||
|
@ -23,45 +23,45 @@
|
||||
|
||||
package com.iluwatar.subclasssandbox;
|
||||
|
||||
import com.github.stefanbirkner.systemlambda.Statement;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.github.stefanbirkner.systemlambda.SystemLambda.tapSystemOutNormalized;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import com.github.stefanbirkner.systemlambda.Statement;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* GroundDive unit tests.
|
||||
*/
|
||||
public class GroundDiveTest {
|
||||
class GroundDiveTest {
|
||||
|
||||
@Test
|
||||
public void testMove() throws Exception {
|
||||
void testMove() throws Exception {
|
||||
var groundDive = new GroundDive();
|
||||
groundDive.move(1.0, 1.0, 1.0);
|
||||
var outputLog = getLogContent(() -> groundDive.move(1.0, 1.0, 1.0));
|
||||
var expectedLog = "Move to ( 1.0, 1.0, 1.0 )";
|
||||
Assert.assertEquals(outputLog, expectedLog);
|
||||
assertEquals(outputLog, expectedLog);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlaySound() throws Exception {
|
||||
void testPlaySound() throws Exception {
|
||||
var groundDive = new GroundDive();
|
||||
var outputLog = getLogContent(() -> groundDive.playSound("SOUND_NAME", 1));
|
||||
var expectedLog = "Play SOUND_NAME with volumn 1";
|
||||
Assert.assertEquals(outputLog, expectedLog);
|
||||
assertEquals(outputLog, expectedLog);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpawnParticles() throws Exception {
|
||||
void testSpawnParticles() throws Exception {
|
||||
var groundDive = new GroundDive();
|
||||
final var outputLog = getLogContent(
|
||||
() -> groundDive.spawnParticles("PARTICLE_TYPE", 100));
|
||||
final var expectedLog = "Spawn 100 particle with type PARTICLE_TYPE";
|
||||
Assert.assertEquals(outputLog, expectedLog);
|
||||
assertEquals(outputLog, expectedLog);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActivate() throws Exception {
|
||||
void testActivate() throws Exception {
|
||||
var groundDive = new GroundDive();
|
||||
var logs = tapSystemOutNormalized(groundDive::activate)
|
||||
.split("\n");
|
||||
@ -72,10 +72,10 @@ public class GroundDiveTest {
|
||||
final var expectedLog2 = "Play GROUNDDIVE_SOUND with volumn 5";
|
||||
final var log3 = getLogContent(logs[2]);
|
||||
final var expectedLog3 = "Spawn 20 particle with type GROUNDDIVE_PARTICLE";
|
||||
Assert.assertEquals(logs.length, expectedSize);
|
||||
Assert.assertEquals(log1, expectedLog1);
|
||||
Assert.assertEquals(log2, expectedLog2);
|
||||
Assert.assertEquals(log3, expectedLog3);
|
||||
assertEquals(logs.length, expectedSize);
|
||||
assertEquals(log1, expectedLog1);
|
||||
assertEquals(log2, expectedLog2);
|
||||
assertEquals(log3, expectedLog3);
|
||||
}
|
||||
|
||||
private String getLogContent(Statement statement) throws Exception {
|
||||
|
@ -23,44 +23,44 @@
|
||||
|
||||
package com.iluwatar.subclasssandbox;
|
||||
|
||||
import com.github.stefanbirkner.systemlambda.Statement;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.github.stefanbirkner.systemlambda.SystemLambda.tapSystemOutNormalized;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import com.github.stefanbirkner.systemlambda.Statement;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* SkyLaunch unit tests.
|
||||
*/
|
||||
public class SkyLaunchTest {
|
||||
class SkyLaunchTest {
|
||||
|
||||
@Test
|
||||
public void testMove() throws Exception {
|
||||
void testMove() throws Exception {
|
||||
var skyLaunch = new SkyLaunch();
|
||||
var outputLog = getLogContent(() -> skyLaunch.move(1.0, 1.0, 1.0));
|
||||
var expectedLog = "Move to ( 1.0, 1.0, 1.0 )";
|
||||
Assert.assertEquals(outputLog, expectedLog);
|
||||
assertEquals(outputLog, expectedLog);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlaySound() throws Exception {
|
||||
void testPlaySound() throws Exception {
|
||||
var skyLaunch = new SkyLaunch();
|
||||
var outputLog = getLogContent(() -> skyLaunch.playSound("SOUND_NAME", 1));
|
||||
var expectedLog = "Play SOUND_NAME with volumn 1";
|
||||
Assert.assertEquals(outputLog, expectedLog);
|
||||
assertEquals(outputLog, expectedLog);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpawnParticles() throws Exception {
|
||||
void testSpawnParticles() throws Exception {
|
||||
var skyLaunch = new SkyLaunch();
|
||||
var outputLog = getLogContent(
|
||||
() -> skyLaunch.spawnParticles("PARTICLE_TYPE", 100));
|
||||
var expectedLog = "Spawn 100 particle with type PARTICLE_TYPE";
|
||||
Assert.assertEquals(outputLog, expectedLog);
|
||||
assertEquals(outputLog, expectedLog);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActivate() throws Exception {
|
||||
void testActivate() throws Exception {
|
||||
var skyLaunch = new SkyLaunch();
|
||||
var logs = tapSystemOutNormalized(skyLaunch::activate)
|
||||
.split("\n");
|
||||
@ -71,10 +71,10 @@ public class SkyLaunchTest {
|
||||
final var expectedLog2 = "Play SKYLAUNCH_SOUND with volumn 1";
|
||||
final var log3 = getLogContent(logs[2]);
|
||||
final var expectedLog3 = "Spawn 100 particle with type SKYLAUNCH_PARTICLE";
|
||||
Assert.assertEquals(logs.length, expectedSize);
|
||||
Assert.assertEquals(log1, expectedLog1);
|
||||
Assert.assertEquals(log2, expectedLog2);
|
||||
Assert.assertEquals(log3, expectedLog3);
|
||||
assertEquals(logs.length, expectedSize);
|
||||
assertEquals(log1, expectedLog1);
|
||||
assertEquals(log2, expectedLog2);
|
||||
assertEquals(log3, expectedLog3);
|
||||
}
|
||||
|
||||
private String getLogContent(Statement statement) throws Exception {
|
||||
|
Reference in New Issue
Block a user