mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 03:35:51 -07:00
Add some testing
This commit is contained in:
43
src/test/java/org/bukkit/ArtTest.java
Normal file
43
src/test/java/org/bukkit/ArtTest.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package org.bukkit;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.EnumArt;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class ArtTest {
|
||||
private static final int UNIT_MULTIPLIER = 16;
|
||||
|
||||
@Test
|
||||
public void verifyMapping() {
|
||||
List<Art> arts = Lists.newArrayList(Art.values());
|
||||
|
||||
for (EnumArt enumArt : EnumArt.values()) {
|
||||
int id = enumArt.ordinal();
|
||||
String name = enumArt.A;
|
||||
int width = enumArt.B / UNIT_MULTIPLIER;
|
||||
int height = enumArt.C / UNIT_MULTIPLIER;
|
||||
|
||||
Art subject = Art.getById(id);
|
||||
|
||||
String message = String.format("org.bukkit.Art is missing id: %d named: '%s'", id - Achievement.STATISTIC_OFFSET, name);
|
||||
assertNotNull(message, subject);
|
||||
|
||||
assertThat(Art.getByName(name), is(subject));
|
||||
assertThat("Art." + subject + "'s width", subject.getBlockWidth(), is(width));
|
||||
assertThat("Art." + subject + "'s height", subject.getBlockHeight(), is(height));
|
||||
|
||||
arts.remove(subject);
|
||||
}
|
||||
|
||||
assertThat("org.bukkit.Art has too many arts", arts, hasSize(0));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user