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

Provides a JUnit 5 extension that prepares the PowerNukkit environment to execute tests without having to create too many mocks

License

Notifications You must be signed in to change notification settings

PowerNukkitX/PowerNukkitX-JUnit5-Framework

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Provides a JUnit 5 extension that prepares the PowerNukkit environment to execute tests without having to create too many mocks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%