mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 12:41:50 +01:00
Add isSolid() tests for each material
This commit is contained in:
parent
12c7c2f695
commit
4d2a92ed47
2 changed files with 47 additions and 13 deletions
15
pom.xml
15
pom.xml
|
@ -11,7 +11,7 @@
|
|||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<api.version>unknown</api.version>
|
||||
<junit.version>4.10</junit.version>
|
||||
<junit.version>4.11</junit.version>
|
||||
<minecraft.version>1.4.5</minecraft.version>
|
||||
<minecraft_version>1_4_5</minecraft_version>
|
||||
</properties>
|
||||
|
@ -135,15 +135,9 @@
|
|||
<!-- testing -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit-dep</artifactId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
|
@ -275,11 +269,6 @@
|
|||
<shadedPattern>net.minecraft.server.v${minecraft_version}</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>junit:junit</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
45
src/test/java/org/bukkit/PerMaterialTest.java
Normal file
45
src/test/java/org/bukkit/PerMaterialTest.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package org.bukkit;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.AchievementList;
|
||||
import net.minecraft.server.Block;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.junit.runners.Parameterized.Parameter;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class PerMaterialTest {
|
||||
static {
|
||||
AchievementList.a();
|
||||
}
|
||||
|
||||
@Parameters(name= "{index}: {0}")
|
||||
public static List<Object[]> data() {
|
||||
List<Object[]> list = new ArrayList<Object[]>();
|
||||
for (Material material : Material.values()) {
|
||||
list.add(new Object[] {material});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Parameter public Material material;
|
||||
|
||||
@Test
|
||||
public void isSolid() {
|
||||
if (material == Material.AIR) {
|
||||
assertFalse(material.isSolid());
|
||||
} else if (material.isBlock()) {
|
||||
assertThat(material.isSolid(), is(Block.byId[material.getId()].material.isSolid()));
|
||||
} else {
|
||||
assertFalse(material.isSolid());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue