2012-01-29 11:22:11 +01:00
|
|
|
package org.bukkit;
|
|
|
|
|
2012-12-14 09:02:02 +01:00
|
|
|
import static org.junit.Assert.*;
|
|
|
|
import static org.hamcrest.Matchers.*;
|
2012-01-29 11:22:11 +01:00
|
|
|
|
2012-12-14 09:02:02 +01:00
|
|
|
import java.util.Collections;
|
2012-01-29 11:22:11 +01:00
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import net.minecraft.server.Item;
|
|
|
|
|
|
|
|
import org.bukkit.support.AbstractTestingBase;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
|
|
public class MaterialTest extends AbstractTestingBase {
|
2012-12-14 09:02:02 +01:00
|
|
|
|
2012-01-29 11:22:11 +01:00
|
|
|
@Test
|
|
|
|
public void verifyMapping() {
|
|
|
|
Map<Integer, Material> materials = Maps.newHashMap();
|
|
|
|
for (Material material : Material.values()) {
|
|
|
|
materials.put(material.getId(), material);
|
|
|
|
}
|
|
|
|
materials.remove(0); // Purge air.
|
|
|
|
|
|
|
|
for (Item item : Item.byId) {
|
|
|
|
if (item == null) continue;
|
|
|
|
|
|
|
|
int id = item.id;
|
|
|
|
String name = item.getName();
|
|
|
|
|
|
|
|
Material material = materials.remove(id);
|
|
|
|
|
2012-12-14 09:02:02 +01:00
|
|
|
assertThat("Missing " + name + "(" + id + ")", material, is(not(nullValue())));
|
2012-01-29 11:22:11 +01:00
|
|
|
}
|
|
|
|
|
2012-12-14 09:02:02 +01:00
|
|
|
assertThat(materials, is(Collections.EMPTY_MAP));
|
2012-01-29 11:22:11 +01:00
|
|
|
}
|
|
|
|
}
|