From d58f8954506c270e22f3052926de17b72cd68443 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 29 Apr 2023 17:44:42 +1000 Subject: [PATCH] Add test for Chunk.LoadLevel mirroring By: md_5 --- .../java/org/bukkit/ChunkLoadLevelTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 paper-server/src/test/java/org/bukkit/ChunkLoadLevelTest.java diff --git a/paper-server/src/test/java/org/bukkit/ChunkLoadLevelTest.java b/paper-server/src/test/java/org/bukkit/ChunkLoadLevelTest.java new file mode 100644 index 0000000000..e5bc2ffd34 --- /dev/null +++ b/paper-server/src/test/java/org/bukkit/ChunkLoadLevelTest.java @@ -0,0 +1,22 @@ +package org.bukkit; + +import net.minecraft.server.level.PlayerChunk; +import org.junit.Assert; +import org.junit.Test; + +public class ChunkLoadLevelTest { + + @Test + public void testOrdinalsAndNames() { + Chunk.LoadLevel[] bukkit = Chunk.LoadLevel.values(); + PlayerChunk.State[] nms = PlayerChunk.State.values(); + + Assert.assertEquals("Enum length mismatch", bukkit.length - 1, nms.length); // Final entry is Bukkit-specific UNLOADED + for (int i = 0; i < nms.length; i++) { + Assert.assertEquals("Enum name mismatch, expected Bukkit " + bukkit[i] + " got NMS " + nms[i], bukkit[i].name(), nms[i].name()); + } + + // Check that Bukkit-specific UNLOADED is last + Assert.assertEquals("Final Bukkit entry should be UNLOADED", Chunk.LoadLevel.UNLOADED, bukkit[bukkit.length - 1]); + } +}