Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Latest commit

 

History

History
71 lines (59 loc) · 2.25 KB

README.md

File metadata and controls

71 lines (59 loc) · 2.25 KB

nukkit

License: GPL v3 Discord

PowerNukkitX JUnit 5 Testing Framework

PowerNukkitX 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.

PowerNukkitX JUnit 5 Testing Framework is an extension to JUnit 5 that allows developers to create easier PowerNukkitX testing codes when developing plugins, tools, and PowerNukkitX itself.

Adding as Dependency

Maven

<repository>
    <id>maven-powernukkitx-cn</id>
    <url>https://maven.powernukkitx.cn/repository/maven-public/</url>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>

<dependencies>
    <dependency>
        <groupId>cn.powernukkitx</groupId>
        <artifactId>powernukkitx-tests-junit5</artifactId>
        <version>0.0.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Gradle

repositories {
    mavenCentral()
}
dependencies {
    testImplementation 'cn.powernukkitx:powernukkitx-tests-junit5:0.0.1'
}

Example Usage

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 PowerNukkitX itself using JUnit5.

Java Documentation

The javadoc files can be viewed online at:
https://powernukkit.github.io/PowerNukkit-JUnit5-Framework/javadoc/0.1.0