3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

Add isSolid() tests for each material

Dieser Commit ist enthalten in:
Wesley Wolfe 2012-12-09 15:13:38 -06:00
Ursprung 12c7c2f695
Commit 4d2a92ed47
2 geänderte Dateien mit 47 neuen und 13 gelöschten Zeilen

15
pom.xml
Datei anzeigen

@ -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>

Datei anzeigen

@ -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());
}
}
}