mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-02 11:22:01 +01:00
Add ItemRarity test (#6247)
This commit is contained in:
parent
012cb6b015
commit
e00202c42a
@ -29,3 +29,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
diff --git a/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java b/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java
|
||||||
|
@@ -0,0 +0,0 @@
|
||||||
|
+package io.papermc.paper.inventory;
|
||||||
|
+
|
||||||
|
+import io.papermc.paper.adventure.PaperAdventure;
|
||||||
|
+import net.minecraft.world.item.Rarity;
|
||||||
|
+import org.junit.Test;
|
||||||
|
+
|
||||||
|
+import static org.junit.Assert.assertEquals;
|
||||||
|
+
|
||||||
|
+public class ItemRarityTest {
|
||||||
|
+
|
||||||
|
+ @Test
|
||||||
|
+ public void testConvertFromNmsToBukkit() {
|
||||||
|
+ for (Rarity nmsRarity : Rarity.values()) {
|
||||||
|
+ assertEquals("rarity names are mis-matched", ItemRarity.values()[nmsRarity.ordinal()].name(), nmsRarity.name());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Test
|
||||||
|
+ public void testRarityFormatting() {
|
||||||
|
+ for (Rarity nmsRarity : Rarity.values()) {
|
||||||
|
+ assertEquals("rarity formatting is mis-matched", nmsRarity.color, PaperAdventure.asVanilla(ItemRarity.values()[nmsRarity.ordinal()].color));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
Loading…
Reference in New Issue
Block a user