diff --git a/patches/server/0643-Item-Rarity-API.patch b/patches/server/0643-Item-Rarity-API.patch index cddc791889..2ed39999c9 100644 --- a/patches/server/0643-Item-Rarity-API.patch +++ b/patches/server/0643-Item-Rarity-API.patch @@ -29,3 +29,33 @@ index 21c1d6b7e97a1dee372ea1fa8eb95a712db63418..e606c246f486eb0775a577ee7ccc87a8 // 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..38e6d42098f216b1d24f50386e7be98181122d8d +--- /dev/null ++++ b/src/test/java/io/papermc/paper/inventory/ItemRarityTest.java +@@ -0,0 +1,24 @@ ++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)); ++ } ++ } ++}