EntityLocation.clone() unit test
This commit is contained in:
@@ -29,6 +29,6 @@ public class EntityLocation extends Location implements Cloneable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityLocation clone() {
|
public EntityLocation clone() {
|
||||||
return (EntityLocation) super.clone(); //TODO need test
|
return (EntityLocation) super.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
100
core/src/test/java/mc/core/EntityLocationTest.java
Normal file
100
core/src/test/java/mc/core/EntityLocationTest.java
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
package mc.core;
|
||||||
|
|
||||||
|
import com.flowpowered.nbt.Tag;
|
||||||
|
import mc.core.world.ChunkSection;
|
||||||
|
import mc.core.world.IWorldType;
|
||||||
|
import mc.core.world.Region;
|
||||||
|
import mc.core.world.World;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class EntityLocationTest {
|
||||||
|
@Test
|
||||||
|
public void cloneTest() {
|
||||||
|
World dummyWorld = new World() {
|
||||||
|
@Override
|
||||||
|
public UUID getWorldId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWorldType getWorldType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityLocation getSpawn() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSpawn(EntityLocation location) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChunkSection getChunk(int x, int y, int z) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setChunk(int x, int y, int z, ChunkSection chunkSection) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Region getRegion(int x, int z) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRegion(int x, int z, Region region) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSeed() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setName(String name) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Tag<?> getTag(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTag(Tag<?> tag) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<Tag<?>> tagStream() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
EntityLocation firstLocation = new EntityLocation(10, 20, 30, 40, 50, dummyWorld);
|
||||||
|
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.assertEquals("World mismatch", firstLocation.getWorld(), locationClone.getWorld());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user