From 5b542913b90b98da3b26133a93f61d67f74200e2 Mon Sep 17 00:00:00 2001 From: DmitriyMX Date: Sun, 26 Aug 2018 00:27:19 +0300 Subject: [PATCH] optimize imports --- .../test/java/mc/core/TestEntityLocation.java | 18 +++++++++--------- core/src/test/java/mc/core/TestLocation.java | 1 - .../mc/core/utils/TestCompactedCoords.java | 17 +++++++++-------- .../packets/TestChunkdataPacket.java | 10 ++++++---- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/core/src/test/java/mc/core/TestEntityLocation.java b/core/src/test/java/mc/core/TestEntityLocation.java index d1dddf6..06fbfa7 100644 --- a/core/src/test/java/mc/core/TestEntityLocation.java +++ b/core/src/test/java/mc/core/TestEntityLocation.java @@ -1,10 +1,10 @@ package mc.core; import mc.core.world.World; -import org.junit.Assert; import org.junit.Test; -import org.mockito.Mockito; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; import static org.mockito.Mockito.mock; public class TestEntityLocation { @@ -13,14 +13,14 @@ public class TestEntityLocation { World dummyWorld = mock(World.class); EntityLocation firstLocation = new EntityLocation(10, 20, 30, 40, 50, dummyWorld); - Assert.assertSame("Lost world reference before cloning", dummyWorld, firstLocation.getWorld()); + assertSame("Lost world reference before cloning", dummyWorld, firstLocation.getWorld()); EntityLocation locationClone = firstLocation.clone(); - Assert.assertEquals("X mismatch", firstLocation.getX(), locationClone.getX(), 0); - Assert.assertEquals("Y mismatch", firstLocation.getY(), locationClone.getY(), 0); - Assert.assertEquals("Z mismatch", firstLocation.getZ(), locationClone.getZ(), 0); - Assert.assertEquals("Pitch mismatch", firstLocation.getPitch(), locationClone.getPitch(), 0); - Assert.assertEquals("Yaw mismatch", firstLocation.getYaw(), locationClone.getYaw(), 0); - Assert.assertSame("World mismatch (accidental clone of the World object?)", firstLocation.getWorld(), locationClone.getWorld()); + assertEquals("X mismatch", firstLocation.getX(), locationClone.getX(), 0); + assertEquals("Y mismatch", firstLocation.getY(), locationClone.getY(), 0); + assertEquals("Z mismatch", firstLocation.getZ(), locationClone.getZ(), 0); + assertEquals("Pitch mismatch", firstLocation.getPitch(), locationClone.getPitch(), 0); + assertEquals("Yaw mismatch", firstLocation.getYaw(), locationClone.getYaw(), 0); + assertSame("World mismatch (accidental clone of the World object?)", firstLocation.getWorld(), locationClone.getWorld()); } } diff --git a/core/src/test/java/mc/core/TestLocation.java b/core/src/test/java/mc/core/TestLocation.java index 239c2c4..3d6715e 100644 --- a/core/src/test/java/mc/core/TestLocation.java +++ b/core/src/test/java/mc/core/TestLocation.java @@ -4,7 +4,6 @@ import mc.core.world.World; import mc.core.world.chunk.Chunk; import org.junit.Before; import org.junit.Test; -import org.mockito.stubbing.Answer; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.*; diff --git a/core/src/test/java/mc/core/utils/TestCompactedCoords.java b/core/src/test/java/mc/core/utils/TestCompactedCoords.java index 4d3da4e..0aef3da 100644 --- a/core/src/test/java/mc/core/utils/TestCompactedCoords.java +++ b/core/src/test/java/mc/core/utils/TestCompactedCoords.java @@ -1,10 +1,11 @@ package mc.core.utils; -import org.junit.Assert; import org.junit.Test; import java.util.Random; +import static org.junit.Assert.assertEquals; + public class TestCompactedCoords { @Test @@ -14,8 +15,8 @@ public class TestCompactedCoords { int compressXZ = CompactedCoords.compressXZ(x, z); int[] xz = CompactedCoords.uncompressXZ(compressXZ); - Assert.assertEquals(x, xz[0]); - Assert.assertEquals(z, xz[1]); + assertEquals(x, xz[0]); + assertEquals(z, xz[1]); } } } @@ -38,8 +39,8 @@ public class TestCompactedCoords { int compressXZ = CompactedCoords.compressXZ(x, z); int[] xz = CompactedCoords.uncompressXZ(compressXZ); - Assert.assertEquals(x, xz[0]); - Assert.assertEquals(z, xz[1]); + assertEquals(x, xz[0]); + assertEquals(z, xz[1]); } } @@ -51,9 +52,9 @@ public class TestCompactedCoords { long compressXYZ = CompactedCoords.compressXYZ(x, y, z); double[] xyz = CompactedCoords.uncompressXYZ(compressXYZ); - Assert.assertEquals(x, xyz[0], 0.001d); - Assert.assertEquals(y, xyz[1], 0.001d); - Assert.assertEquals(z, xyz[2], 0.001d); + assertEquals(x, xyz[0], 0.001d); + assertEquals(y, xyz[1], 0.001d); + assertEquals(z, xyz[2], 0.001d); } } } diff --git a/proto_1.12.2/src/test/java/mc/core/network/proto_1_12_2/packets/TestChunkdataPacket.java b/proto_1.12.2/src/test/java/mc/core/network/proto_1_12_2/packets/TestChunkdataPacket.java index d4febe9..ba9147a 100644 --- a/proto_1.12.2/src/test/java/mc/core/network/proto_1_12_2/packets/TestChunkdataPacket.java +++ b/proto_1.12.2/src/test/java/mc/core/network/proto_1_12_2/packets/TestChunkdataPacket.java @@ -9,13 +9,15 @@ import mc.core.world.block.BlockFactory; import mc.core.world.block.BlockType; import mc.core.world.chunk.Chunk; import mc.core.world.chunk.ChunkSection; -import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import java.io.*; +import java.io.IOException; +import java.io.InputStream; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -86,7 +88,7 @@ public class TestChunkdataPacket { packet.writeSelf(netStream); byte[] actualPacketData = netStream.toByteArray(); - Assert.assertEquals(expectedPacketData.length, actualPacketData.length); - Assert.assertArrayEquals(expectedPacketData, actualPacketData); + assertEquals(expectedPacketData.length, actualPacketData.length); + assertArrayEquals(expectedPacketData, actualPacketData); } }