PowerNukkit is a modified version of Nukkit that adds support to a huge amount of features like water-logging, all new blocks, more plugin events, offhand slot, bug fixes and many more.
JUnit is a very popular Java test unit framework.
PowerNukkit JUnit 5 Testing Framework is an extension to JUnit 5 that allows developers to create easier PowerNukkit testing codes when developing plugins, tools, and PowerNukkit itself.
<dependencies>
<dependency>
<groupId>org.powernukkit</groupId>
<artifactId>powernukkit-tests-junit5</artifactId>
<version>0.1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.powernukkit:powernukkit-tests-junit5:0.1.1'
}
import cn.nukkit.block.Block;
import cn.nukkit.block.BlockID;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.powernukkit.tests.junit.jupiter.PowerNukkitExtension;
import static org.junit.jupiter.api.Assertions.*;
@ExtendWith(PowerNukkitExtension.class)
class MyAwesomeTest {
@Test
void testStoneClass() {
assertEquals(BlockStone.class, Block.get(BlockID.STONE).getClass());
}
}
There are tons of usage example at https://github.com/PowerNukkit/PowerNukkit/tree/master/src/test because we use this extension to test PowerNukkit itself using JUnit5.
The javadoc files can be viewed online at:
https://powernukkit.github.io/PowerNukkit-JUnit5-Framework/javadoc/0.1.0