переименование тестов
This commit is contained in:
@@ -8,7 +8,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
class TestEntityLocation {
|
class EntityLocationTest {
|
||||||
private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
|
private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
|
||||||
private static final double minD = 0.0d, maxD = 10.0d;
|
private static final double minD = 0.0d, maxD = 10.0d;
|
||||||
private static final float minF = 0.0f, maxF = 359.9f;
|
private static final float minF = 0.0f, maxF = 359.9f;
|
||||||
@@ -25,7 +25,7 @@ class TestEntityLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testEquals() {
|
void equals_() {
|
||||||
EntityLocation loc1 = new EntityLocation(x, y, z, yaw, pitch);
|
EntityLocation loc1 = new EntityLocation(x, y, z, yaw, pitch);
|
||||||
EntityLocation loc2 = new EntityLocation(x, y, z, yaw, pitch);
|
EntityLocation loc2 = new EntityLocation(x, y, z, yaw, pitch);
|
||||||
assertEquals(loc1, loc2);
|
assertEquals(loc1, loc2);
|
||||||
@@ -38,14 +38,14 @@ class TestEntityLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testClone() {
|
void clone_() {
|
||||||
EntityLocation locOrig = new EntityLocation(x, y, z, yaw, pitch);
|
EntityLocation locOrig = new EntityLocation(x, y, z, yaw, pitch);
|
||||||
EntityLocation locClone = locOrig.clone();
|
EntityLocation locClone = locOrig.clone();
|
||||||
assertEquals(locOrig, locClone);
|
assertEquals(locOrig, locClone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetBlockXZ() {
|
void getBlockXZ() {
|
||||||
EntityLocation location;
|
EntityLocation location;
|
||||||
|
|
||||||
location = new EntityLocation(0d, 0, 0d, 0f, 0f);
|
location = new EntityLocation(0d, 0, 0d, 0f, 0f);
|
||||||
@@ -5,10 +5,10 @@ import org.junit.jupiter.api.Test;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
class TestImmutableEntityLocation {
|
class ImmutableEntityLocationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSetValue() {
|
void setValue() {
|
||||||
EntityLocation location = new ImmutableEntityLocation(1d, 2d, 3d, 4f, 5f);
|
EntityLocation location = new ImmutableEntityLocation(1d, 2d, 3d, 4f, 5f);
|
||||||
|
|
||||||
assertThrows(UnsupportedOperationException.class, () -> {
|
assertThrows(UnsupportedOperationException.class, () -> {
|
||||||
@@ -24,7 +24,7 @@ class TestImmutableEntityLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testClone() {
|
void clone_() {
|
||||||
EntityLocation locOrig = new ImmutableEntityLocation(1d, 2d, 3d, 4f, 5f);
|
EntityLocation locOrig = new ImmutableEntityLocation(1d, 2d, 3d, 4f, 5f);
|
||||||
EntityLocation locClone = locOrig.clone();
|
EntityLocation locClone = locOrig.clone();
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ import static org.mockito.Mockito.mock;
|
|||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SpringConfig {
|
public class TestSpringConfig {
|
||||||
@Bean()
|
@Bean()
|
||||||
public World simpleMockWorld() {
|
public World simpleMockWorld() {
|
||||||
return mock(World.class);
|
return mock(World.class);
|
||||||
@@ -4,9 +4,9 @@ import org.junit.jupiter.api.Test;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class TestText {
|
class TextTest {
|
||||||
@Test
|
@Test
|
||||||
void testToPlain() {
|
void toPlain() {
|
||||||
final String m1 = "mes";
|
final String m1 = "mes";
|
||||||
final String m2 = "sage";
|
final String m2 = "sage";
|
||||||
final String message = m1 + m2;
|
final String message = m1 + m2;
|
||||||
@@ -26,7 +26,7 @@ class TestText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testEquals() {
|
void equals_() {
|
||||||
assertEquals(Text.of(), Text.of(""));
|
assertEquals(Text.of(), Text.of(""));
|
||||||
assertEquals(Text.of(), Text.builder().build());
|
assertEquals(Text.of(), Text.builder().build());
|
||||||
assertEquals(Text.of(), Text.builder("").build());
|
assertEquals(Text.of(), Text.builder("").build());
|
||||||
@@ -44,7 +44,7 @@ class TestText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testEmpty() {
|
void isEmpty() {
|
||||||
assertTrue(Text.of().isEmpty());
|
assertTrue(Text.of().isEmpty());
|
||||||
assertTrue(Text.of((String) null).isEmpty());
|
assertTrue(Text.of((String) null).isEmpty());
|
||||||
assertTrue(Text.of((Text) null).isEmpty());
|
assertTrue(Text.of((Text) null).isEmpty());
|
||||||
@@ -6,9 +6,9 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
class TestCompactedCoords {
|
class CompactedCoordsTest {
|
||||||
@Test
|
@Test
|
||||||
void testXZ() {
|
void compressXZ() {
|
||||||
ThreadLocalRandom random = ThreadLocalRandom.current();
|
ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++) {
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package mc.core;
|
package mc.core.world.block;
|
||||||
|
|
||||||
import mc.core.world.block.BlockLocation;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@@ -9,7 +8,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
class TestBlockLocation {
|
class BlockLocationTest {
|
||||||
private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
|
private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
|
||||||
private static final int minI = 0, maxI = 10;
|
private static final int minI = 0, maxI = 10;
|
||||||
private int x, y, z;
|
private int x, y, z;
|
||||||
@@ -22,7 +21,7 @@ class TestBlockLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testEquals() {
|
void equals_() {
|
||||||
BlockLocation loc1 = new BlockLocation(x, y, z);
|
BlockLocation loc1 = new BlockLocation(x, y, z);
|
||||||
BlockLocation loc2 = new BlockLocation(x, y, z);
|
BlockLocation loc2 = new BlockLocation(x, y, z);
|
||||||
assertEquals(loc1, loc2);
|
assertEquals(loc1, loc2);
|
||||||
@@ -32,7 +31,7 @@ class TestBlockLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testClone() {
|
void clone_() {
|
||||||
BlockLocation locOrig = new BlockLocation(x, y, z);
|
BlockLocation locOrig = new BlockLocation(x, y, z);
|
||||||
BlockLocation locClone = locOrig.clone();
|
BlockLocation locClone = locOrig.clone();
|
||||||
assertEquals(locOrig, locClone);
|
assertEquals(locOrig, locClone);
|
||||||
@@ -18,7 +18,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = {TestSpringConfig.class})
|
@ContextConfiguration(classes = {TestSpringConfig.class})
|
||||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
||||||
class TestH2PlayerManager {
|
class H2PlayerManagerTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private H2PlayerService h2PlayerService;
|
private H2PlayerService h2PlayerService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -27,7 +27,7 @@ class TestH2PlayerManager {
|
|||||||
private H2PlayerManager playerManager;
|
private H2PlayerManager playerManager;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCreatePlayer() {
|
void createPlayer() {
|
||||||
final String playerName = "NEW_PLAYER";
|
final String playerName = "NEW_PLAYER";
|
||||||
final Player newPlayer = playerManager.createPlayer(playerName, EntityLocation.ZERO(), mockWorld);
|
final Player newPlayer = playerManager.createPlayer(playerName, EntityLocation.ZERO(), mockWorld);
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ class TestH2PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJoinServer() {
|
void joinServer() {
|
||||||
assertEquals(0, playerManager.getCountPlayers());
|
assertEquals(0, playerManager.getCountPlayers());
|
||||||
|
|
||||||
final String playerName = "NEW_PLAYER";
|
final String playerName = "NEW_PLAYER";
|
||||||
@@ -57,7 +57,7 @@ class TestH2PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLeftServer() {
|
void leftServer() {
|
||||||
assertEquals(0, playerManager.getCountPlayers());
|
assertEquals(0, playerManager.getCountPlayers());
|
||||||
|
|
||||||
final String playerName = "NEW_PLAYER";
|
final String playerName = "NEW_PLAYER";
|
||||||
@@ -87,7 +87,7 @@ class TestH2PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetPlayer() {
|
void getPlayer() {
|
||||||
assertEquals(0, playerManager.getCountPlayers());
|
assertEquals(0, playerManager.getCountPlayers());
|
||||||
|
|
||||||
final String playerName = "NEW_PLAYER";
|
final String playerName = "NEW_PLAYER";
|
||||||
@@ -104,7 +104,7 @@ class TestH2PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetPlayers() {
|
void getPlayers() {
|
||||||
assertEquals(0, playerManager.getCountPlayers());
|
assertEquals(0, playerManager.getCountPlayers());
|
||||||
|
|
||||||
final String playerName = "NEW_PLAYER";
|
final String playerName = "NEW_PLAYER";
|
||||||
@@ -128,7 +128,7 @@ class TestH2PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetCountPlayers() {
|
void getCountPlayers() {
|
||||||
assertEquals(0, playerManager.getCountPlayers());
|
assertEquals(0, playerManager.getCountPlayers());
|
||||||
|
|
||||||
final String playerName = "NEW_PLAYER";
|
final String playerName = "NEW_PLAYER";
|
||||||
@@ -145,7 +145,7 @@ class TestH2PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetOfflinePlayer() {
|
void getOfflinePlayer() {
|
||||||
final String playerName = "NEW_PLAYER";
|
final String playerName = "NEW_PLAYER";
|
||||||
final Player player = playerManager.createPlayer(playerName, EntityLocation.ZERO(), mockWorld);
|
final Player player = playerManager.createPlayer(playerName, EntityLocation.ZERO(), mockWorld);
|
||||||
playerManager.joinServer(player);
|
playerManager.joinServer(player);
|
||||||
@@ -7,9 +7,9 @@ import java.util.UUID;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
class TestH2Player {
|
class H2PlayerTest {
|
||||||
@Test
|
@Test
|
||||||
void testEquals() {
|
void equals_() {
|
||||||
UUID uuid = UUID.randomUUID();
|
UUID uuid = UUID.randomUUID();
|
||||||
|
|
||||||
H2Player player1 = new H2Player();
|
H2Player player1 = new H2Player();
|
||||||
@@ -7,11 +7,11 @@ import java.util.Random;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
class TestByteArrayInputNetStream {
|
class ByteArrayInputNetStreamTest {
|
||||||
private Random rnd = new Random();
|
private Random rnd = new Random();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testReadByte() {
|
void readByte() {
|
||||||
final byte b0 = (byte) rnd.nextInt();
|
final byte b0 = (byte) rnd.nextInt();
|
||||||
ByteArrayOutputNetStream netStream = new ByteArrayOutputNetStream();
|
ByteArrayOutputNetStream netStream = new ByteArrayOutputNetStream();
|
||||||
netStream.writeByte(b0);
|
netStream.writeByte(b0);
|
||||||
@@ -23,7 +23,7 @@ class TestByteArrayInputNetStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testReadInt() {
|
void readInt() {
|
||||||
final int i0 = rnd.nextInt();
|
final int i0 = rnd.nextInt();
|
||||||
ByteArrayOutputNetStream netStream = new ByteArrayOutputNetStream();
|
ByteArrayOutputNetStream netStream = new ByteArrayOutputNetStream();
|
||||||
netStream.writeInt(i0);
|
netStream.writeInt(i0);
|
||||||
@@ -35,7 +35,7 @@ class TestByteArrayInputNetStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testReadFloat() {
|
void readFloat() {
|
||||||
final float f0 = rnd.nextFloat();
|
final float f0 = rnd.nextFloat();
|
||||||
ByteArrayOutputNetStream netStream = new ByteArrayOutputNetStream();
|
ByteArrayOutputNetStream netStream = new ByteArrayOutputNetStream();
|
||||||
netStream.writeFloat(f0);
|
netStream.writeFloat(f0);
|
||||||
@@ -22,13 +22,13 @@ import static org.mockito.Matchers.anyInt;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
class TestChunkdataPacket {
|
class ChunkdataPacketTest {
|
||||||
private static byte[] expectedPacketData;
|
private static byte[] expectedPacketData;
|
||||||
private World world;
|
private World world;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void beforeClassTest() throws IOException {
|
static void beforeClassTest() throws IOException {
|
||||||
InputStream inputStream = TestChunkdataPacket.class.getResourceAsStream("ChunkDataPacket.bin");
|
InputStream inputStream = ChunkdataPacketTest.class.getResourceAsStream("ChunkDataPacket.bin");
|
||||||
expectedPacketData = ByteStreams.toByteArray(inputStream);
|
expectedPacketData = ByteStreams.toByteArray(inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class TestChunkdataPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() {
|
void writePacket() {
|
||||||
ChunkDataPacket packet = new ChunkDataPacket();
|
ChunkDataPacket packet = new ChunkDataPacket();
|
||||||
packet.setX(0);
|
packet.setX(0);
|
||||||
packet.setZ(0);
|
packet.setZ(0);
|
||||||
@@ -8,7 +8,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
class TestPlayerAbilitiesPacket {
|
class PlayerAbilitiesPacketTest {
|
||||||
private Random rnd = new Random();
|
private Random rnd = new Random();
|
||||||
private PlayerAbilitiesPacket packet;
|
private PlayerAbilitiesPacket packet;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ class TestPlayerAbilitiesPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() {
|
void writePacket() {
|
||||||
ByteArrayOutputNetStream netOutputStream = new ByteArrayOutputNetStream();
|
ByteArrayOutputNetStream netOutputStream = new ByteArrayOutputNetStream();
|
||||||
packet.writeSelf(netOutputStream);
|
packet.writeSelf(netOutputStream);
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
class TestBlockLocationSerializer {
|
class BlockLocationSerializerTest {
|
||||||
private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
|
private static final ThreadLocalRandom rnd = ThreadLocalRandom.current();
|
||||||
private static final int minI = 0, maxI = 10;
|
private static final int minI = 0, maxI = 10;
|
||||||
private int x, y, z;
|
private int x, y, z;
|
||||||
@@ -21,7 +21,7 @@ class TestBlockLocationSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() {
|
void serialize() {
|
||||||
BlockLocation location = new BlockLocation(x, y, z);
|
BlockLocation location = new BlockLocation(x, y, z);
|
||||||
final long serializedCoords = BlockLocationSerializer.toLong(location);
|
final long serializedCoords = BlockLocationSerializer.toLong(location);
|
||||||
|
|
||||||
Reference in New Issue
Block a user