From a677257885de9baf0bda21975380ae0ec7d2c6a9 Mon Sep 17 00:00:00 2001 From: Senmori Date: Sat, 25 Aug 2018 01:35:40 -0400 Subject: Add additional tests for CraftBlockData --- .../java/org/bukkit/BlockDataConversionTest.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/test/java/org/bukkit/BlockDataConversionTest.java (limited to 'src/test/java/org/bukkit/BlockDataConversionTest.java') diff --git a/src/test/java/org/bukkit/BlockDataConversionTest.java b/src/test/java/org/bukkit/BlockDataConversionTest.java new file mode 100644 index 00000000..46cc26b3 --- /dev/null +++ b/src/test/java/org/bukkit/BlockDataConversionTest.java @@ -0,0 +1,38 @@ +package org.bukkit; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.server.Block; +import net.minecraft.server.IBlockData; +import net.minecraft.server.IRegistry; +import org.bukkit.craftbukkit.block.data.CraftBlockData; +import org.bukkit.support.AbstractTestingBase; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +/** + * This test class ensures that all Blocks (as registered in IRegistry.BLOCK) + * can be converted into their CraftBlockData equivalent. + */ +@RunWith(Parameterized.class) +public class BlockDataConversionTest extends AbstractTestingBase { + + @Parameterized.Parameters(name = "{index}: {0}") + public static List args() { + List list = new ArrayList<>(); + for (Block block : (Iterable) IRegistry.BLOCK) { + list.add(new Object[]{block.getBlockData()}); + } + return list; + } + + @Parameterized.Parameter(0) public IBlockData data; + + @Test + public void testNotNull() { + Assert.assertNotNull(data); + Assert.assertNotNull(CraftBlockData.fromData(data)); + } +} -- cgit v1.2.3