Archived
0

optimize imports

This commit is contained in:
2018-08-26 00:27:19 +03:00
parent bf8d820848
commit 5b542913b9
4 changed files with 24 additions and 22 deletions

View File

@@ -1,10 +1,10 @@
package mc.core; package mc.core;
import mc.core.world.World; import mc.core.world.World;
import org.junit.Assert;
import org.junit.Test; 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; import static org.mockito.Mockito.mock;
public class TestEntityLocation { public class TestEntityLocation {
@@ -13,14 +13,14 @@ public class TestEntityLocation {
World dummyWorld = mock(World.class); World dummyWorld = mock(World.class);
EntityLocation firstLocation = new EntityLocation(10, 20, 30, 40, 50, dummyWorld); 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(); EntityLocation locationClone = firstLocation.clone();
Assert.assertEquals("X mismatch", firstLocation.getX(), locationClone.getX(), 0); assertEquals("X mismatch", firstLocation.getX(), locationClone.getX(), 0);
Assert.assertEquals("Y mismatch", firstLocation.getY(), locationClone.getY(), 0); assertEquals("Y mismatch", firstLocation.getY(), locationClone.getY(), 0);
Assert.assertEquals("Z mismatch", firstLocation.getZ(), locationClone.getZ(), 0); assertEquals("Z mismatch", firstLocation.getZ(), locationClone.getZ(), 0);
Assert.assertEquals("Pitch mismatch", firstLocation.getPitch(), locationClone.getPitch(), 0); assertEquals("Pitch mismatch", firstLocation.getPitch(), locationClone.getPitch(), 0);
Assert.assertEquals("Yaw mismatch", firstLocation.getYaw(), locationClone.getYaw(), 0); assertEquals("Yaw mismatch", firstLocation.getYaw(), locationClone.getYaw(), 0);
Assert.assertSame("World mismatch (accidental clone of the World object?)", firstLocation.getWorld(), locationClone.getWorld()); assertSame("World mismatch (accidental clone of the World object?)", firstLocation.getWorld(), locationClone.getWorld());
} }
} }

View File

@@ -4,7 +4,6 @@ import mc.core.world.World;
import mc.core.world.chunk.Chunk; import mc.core.world.chunk.Chunk;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.stubbing.Answer;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;

View File

@@ -1,10 +1,11 @@
package mc.core.utils; package mc.core.utils;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.util.Random; import java.util.Random;
import static org.junit.Assert.assertEquals;
public class TestCompactedCoords { public class TestCompactedCoords {
@Test @Test
@@ -14,8 +15,8 @@ public class TestCompactedCoords {
int compressXZ = CompactedCoords.compressXZ(x, z); int compressXZ = CompactedCoords.compressXZ(x, z);
int[] xz = CompactedCoords.uncompressXZ(compressXZ); int[] xz = CompactedCoords.uncompressXZ(compressXZ);
Assert.assertEquals(x, xz[0]); assertEquals(x, xz[0]);
Assert.assertEquals(z, xz[1]); assertEquals(z, xz[1]);
} }
} }
} }
@@ -38,8 +39,8 @@ public class TestCompactedCoords {
int compressXZ = CompactedCoords.compressXZ(x, z); int compressXZ = CompactedCoords.compressXZ(x, z);
int[] xz = CompactedCoords.uncompressXZ(compressXZ); int[] xz = CompactedCoords.uncompressXZ(compressXZ);
Assert.assertEquals(x, xz[0]); assertEquals(x, xz[0]);
Assert.assertEquals(z, xz[1]); assertEquals(z, xz[1]);
} }
} }
@@ -51,9 +52,9 @@ public class TestCompactedCoords {
long compressXYZ = CompactedCoords.compressXYZ(x, y, z); long compressXYZ = CompactedCoords.compressXYZ(x, y, z);
double[] xyz = CompactedCoords.uncompressXYZ(compressXYZ); double[] xyz = CompactedCoords.uncompressXYZ(compressXYZ);
Assert.assertEquals(x, xyz[0], 0.001d); assertEquals(x, xyz[0], 0.001d);
Assert.assertEquals(y, xyz[1], 0.001d); assertEquals(y, xyz[1], 0.001d);
Assert.assertEquals(z, xyz[2], 0.001d); assertEquals(z, xyz[2], 0.001d);
} }
} }
} }

View File

@@ -9,13 +9,15 @@ import mc.core.world.block.BlockFactory;
import mc.core.world.block.BlockType; import mc.core.world.block.BlockType;
import mc.core.world.chunk.Chunk; import mc.core.world.chunk.Chunk;
import mc.core.world.chunk.ChunkSection; import mc.core.world.chunk.ChunkSection;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; 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.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;
@@ -86,7 +88,7 @@ public class TestChunkdataPacket {
packet.writeSelf(netStream); packet.writeSelf(netStream);
byte[] actualPacketData = netStream.toByteArray(); byte[] actualPacketData = netStream.toByteArray();
Assert.assertEquals(expectedPacketData.length, actualPacketData.length); assertEquals(expectedPacketData.length, actualPacketData.length);
Assert.assertArrayEquals(expectedPacketData, actualPacketData); assertArrayEquals(expectedPacketData, actualPacketData);
} }
} }