forked from ChestShop-authors/ChestShop-3
-
Notifications
You must be signed in to change notification settings - Fork 2
/
MaterialTest.java
45 lines (39 loc) · 1.19 KB
/
MaterialTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.Acrobot.ChestShop.Tests;
import com.Acrobot.Breeze.Utils.MaterialUtil;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.junit.Assert.assertTrue;
/**
* Tests for {@link com.Acrobot.Breeze.Utils.MaterialUtil}
*
* @author Acrobot
*/
@RunWith(JUnit4.class)
public class MaterialTest {
@Test
public void testForBlank() {
ItemStack air = new ItemStack(Material.AIR);
assertTrue(MaterialUtil.isEmpty(air));
assertTrue(MaterialUtil.isEmpty(null));
}
@Test
public void testNameCollisions() {
boolean anyFail = false;
for (Material m : Material.values()) {
if (!m.name().startsWith("LEGACY_")) {
String materialName = MaterialUtil.getSignMaterialName(m, "");
Material m2 = MaterialUtil.getMaterial(materialName);
if (m != m2) {
System.err.println("Material " + m + " becomes " + m2);
anyFail = true;
}
}
}
if (anyFail) {
throw new AssertionError();
}
}
}