diff --git a/src/test/java/net/minestom/server/snapshot/ChunkSnapshotIntegrationTest.java b/src/test/java/net/minestom/server/snapshot/ChunkSnapshotIntegrationTest.java new file mode 100644 index 000000000..29e1f44fd --- /dev/null +++ b/src/test/java/net/minestom/server/snapshot/ChunkSnapshotIntegrationTest.java @@ -0,0 +1,26 @@ +package net.minestom.server.snapshot; + +import net.minestom.server.api.Env; +import net.minestom.server.api.EnvTest; +import net.minestom.server.instance.block.Block; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@EnvTest +public class ChunkSnapshotIntegrationTest { + + @Test + public void blocks(Env env) { + var instance = env.createFlatInstance(); + instance.setBlock(0, 0, 0, Block.STONE); + var snapshot = ServerSnapshot.update(); + + var inst = snapshot.instances().iterator().next(); + assertEquals(Block.STONE, inst.getBlock(0, 0, 0)); + + assertEquals(1, inst.chunks().size()); + var chunk = inst.chunks().iterator().next(); + assertEquals(Block.STONE, chunk.getBlock(0, 0, 0)); + } +} diff --git a/src/test/java/net/minestom/server/snapshot/SnapshotIntegrationTest.java b/src/test/java/net/minestom/server/snapshot/EntitySnapshotIntegrationTest.java similarity index 50% rename from src/test/java/net/minestom/server/snapshot/SnapshotIntegrationTest.java rename to src/test/java/net/minestom/server/snapshot/EntitySnapshotIntegrationTest.java index 477f56dc3..942214c94 100644 --- a/src/test/java/net/minestom/server/snapshot/SnapshotIntegrationTest.java +++ b/src/test/java/net/minestom/server/snapshot/EntitySnapshotIntegrationTest.java @@ -4,57 +4,16 @@ import net.minestom.server.api.Env; import net.minestom.server.api.EnvTest; import net.minestom.server.entity.Entity; import net.minestom.server.entity.EntityType; -import net.minestom.server.instance.block.Block; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @EnvTest -public class SnapshotIntegrationTest { +public class EntitySnapshotIntegrationTest { @Test - public void instance(Env env) { - env.createFlatInstance(); - var snapshot = ServerSnapshot.update(); - - // Ensure that the collection is immutable - { - var instances = snapshot.instances(); - assertEquals(1, instances.size()); - - env.createFlatInstance(); - instances = snapshot.instances(); - assertEquals(1, instances.size()); - } - - var inst = snapshot.instances().iterator().next(); - - assertEquals(snapshot, inst.server(), "Instance must have access to the server snapshot"); - - assertEquals(0, inst.time()); - assertEquals(0, inst.worldAge()); - - assertEquals(0, inst.chunks().size()); - assertEquals(0, inst.entities().size()); - } - - @Test - public void chunk(Env env) { - var instance = env.createFlatInstance(); - instance.setBlock(0, 0, 0, Block.STONE); - var snapshot = ServerSnapshot.update(); - - var inst = snapshot.instances().iterator().next(); - assertEquals(Block.STONE, inst.getBlock(0, 0, 0)); - - assertEquals(1, inst.chunks().size()); - var chunk = inst.chunks().iterator().next(); - assertEquals(Block.STONE, chunk.getBlock(0, 0, 0)); - } - - @Test - public void entity(Env env) { + public void basic(Env env) { var instance = env.createFlatInstance(); var ent = new Entity(EntityType.ZOMBIE); ent.setInstance(instance).join(); diff --git a/src/test/java/net/minestom/server/snapshot/InstanceSnapshotIntegrationTest.java b/src/test/java/net/minestom/server/snapshot/InstanceSnapshotIntegrationTest.java new file mode 100644 index 000000000..88fbf1fc0 --- /dev/null +++ b/src/test/java/net/minestom/server/snapshot/InstanceSnapshotIntegrationTest.java @@ -0,0 +1,37 @@ +package net.minestom.server.snapshot; + +import net.minestom.server.api.Env; +import net.minestom.server.api.EnvTest; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@EnvTest +public class InstanceSnapshotIntegrationTest { + + @Test + public void basic(Env env) { + env.createFlatInstance(); + var snapshot = ServerSnapshot.update(); + + // Ensure that the collection is immutable + { + var instances = snapshot.instances(); + assertEquals(1, instances.size()); + + env.createFlatInstance(); + instances = snapshot.instances(); + assertEquals(1, instances.size()); + } + + var inst = snapshot.instances().iterator().next(); + + assertEquals(snapshot, inst.server(), "Instance must have access to the server snapshot"); + + assertEquals(0, inst.time()); + assertEquals(0, inst.worldAge()); + + assertEquals(0, inst.chunks().size()); + assertEquals(0, inst.entities().size()); + } +}