summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/bukkit/EnchantmentTest.java
blob: 86bfbb45a4d9a515a2cb4189c89f013638d1a6cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package org.bukkit;

import net.minecraft.server.MinecraftKey;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;
import org.junit.Test;

public class EnchantmentTest extends AbstractTestingBase {

    @Test
    public void verifyMapping() {
        for (MinecraftKey key : net.minecraft.server.Enchantment.enchantments.keySet()) {
            net.minecraft.server.Enchantment nms = net.minecraft.server.Enchantment.enchantments.get(key);

            Enchantment bukkitById = Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(key));

            Assert.assertFalse("Unknown enchant name for " + key, bukkitById.getName().startsWith("UNKNOWN"));

            Assert.assertNotNull("Unknown target for " + key, bukkitById.getItemTarget());
        }
    }
}