JUnit4 -> JUnit5
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
package mc.core;
|
||||
|
||||
import mc.core.world.block.BlockLocation;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
||||
public class TestBlockLocation {
|
||||
class TestBlockLocation {
|
||||
private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
|
||||
private static final int minI = 0, maxI = 10;
|
||||
private int x, y, z;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
@BeforeEach
|
||||
void before() {
|
||||
x = rnd.nextInt(minI, maxI);
|
||||
y = rnd.nextInt(minI, maxI);
|
||||
z = rnd.nextInt(minI, maxI);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
void testEquals() {
|
||||
BlockLocation loc1 = new BlockLocation(x, y, z);
|
||||
BlockLocation loc2 = new BlockLocation(x, y, z);
|
||||
assertEquals(loc1, loc2);
|
||||
@@ -32,7 +32,7 @@ public class TestBlockLocation {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClone() {
|
||||
void testClone() {
|
||||
BlockLocation locOrig = new BlockLocation(x, y, z);
|
||||
BlockLocation locClone = locOrig.clone();
|
||||
assertEquals(locOrig, locClone);
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
package mc.core;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
||||
public class TestEntityLocation {
|
||||
class TestEntityLocation {
|
||||
private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
|
||||
private static final double minD = 0.0d, maxD = 10.0d;
|
||||
private static final float minF = 0.0f, maxF = 359.9f;
|
||||
private double x, y, z;
|
||||
private float yaw, pitch;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
@BeforeEach
|
||||
void before() {
|
||||
x = rnd.nextDouble(minD, maxD);
|
||||
y = rnd.nextDouble(minD, maxD);
|
||||
z = rnd.nextDouble(minD, maxD);
|
||||
@@ -25,7 +25,7 @@ public class TestEntityLocation {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
void testEquals() {
|
||||
EntityLocation loc1 = new EntityLocation(x, y, z, yaw, pitch);
|
||||
EntityLocation loc2 = new EntityLocation(x, y, z, yaw, pitch);
|
||||
assertEquals(loc1, loc2);
|
||||
@@ -38,14 +38,14 @@ public class TestEntityLocation {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClone() {
|
||||
void testClone() {
|
||||
EntityLocation locOrig = new EntityLocation(x, y, z, yaw, pitch);
|
||||
EntityLocation locClone = locOrig.clone();
|
||||
assertEquals(locOrig, locClone);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBlockXZ() {
|
||||
void testGetBlockXZ() {
|
||||
EntityLocation location;
|
||||
|
||||
location = new EntityLocation(0d, 0, 0d, 0f, 0f);
|
||||
|
||||
@@ -1,32 +1,30 @@
|
||||
package mc.core;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class TestImmutableEntityLocation {
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
class TestImmutableEntityLocation {
|
||||
|
||||
@Test
|
||||
public void testSetValue() {
|
||||
void testSetValue() {
|
||||
EntityLocation location = new ImmutableEntityLocation(1d, 2d, 3d, 4f, 5f);
|
||||
|
||||
thrown.expect(UnsupportedOperationException.class);
|
||||
location.setX(1);
|
||||
location.setY(1);
|
||||
location.setZ(1);
|
||||
location.setYaw(1);
|
||||
location.setPitch(1);
|
||||
location.setXYZ(1, 2, 3);
|
||||
location.setYawPitch(1, 2);
|
||||
location.set(EntityLocation.ZERO());
|
||||
assertThrows(UnsupportedOperationException.class, () -> {
|
||||
location.setX(1);
|
||||
location.setY(1);
|
||||
location.setZ(1);
|
||||
location.setYaw(1);
|
||||
location.setPitch(1);
|
||||
location.setXYZ(1, 2, 3);
|
||||
location.setYawPitch(1, 2);
|
||||
location.set(EntityLocation.ZERO());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClone() {
|
||||
void testClone() {
|
||||
EntityLocation locOrig = new ImmutableEntityLocation(1d, 2d, 3d, 4f, 5f);
|
||||
EntityLocation locClone = locOrig.clone();
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package mc.core.text;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TestText {
|
||||
class TestText {
|
||||
@Test
|
||||
public void testToPlain() {
|
||||
void testToPlain() {
|
||||
final String m1 = "mes";
|
||||
final String m2 = "sage";
|
||||
final String message = m1 + m2;
|
||||
@@ -26,7 +26,7 @@ public class TestText {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
void testEquals() {
|
||||
assertEquals(Text.of(), Text.of(""));
|
||||
assertEquals(Text.of(), Text.builder().build());
|
||||
assertEquals(Text.of(), Text.builder("").build());
|
||||
@@ -44,7 +44,7 @@ public class TestText {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmpty() {
|
||||
void testEmpty() {
|
||||
assertTrue(Text.of().isEmpty());
|
||||
assertTrue(Text.of((String) null).isEmpty());
|
||||
assertTrue(Text.of((Text) null).isEmpty());
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package mc.core.utils;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
public class TestCompactedCoords {
|
||||
class TestCompactedCoords {
|
||||
@Test
|
||||
public void testXZ() {
|
||||
void testXZ() {
|
||||
ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
||||
Reference in New Issue
Block a user