Skip to content

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

PowerNukkit/PowerNukkit-JUnit5-Framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nukkit

License: GPL v3 Discord

PowerNukkit JUnit 5 Testing Framework

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.

Adding as Dependency

Maven

    <dependencies>
        <dependency>
            <groupId>org.powernukkit</groupId>
            <artifactId>powernukkit-tests-junit5</artifactId>
            <version>0.1.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

Gradle

repositories {
    mavenCentral()
}
dependencies {
    testImplementation 'org.powernukkit:powernukkit-tests-junit5:0.1.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 PowerNukkit 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

Releases

No releases published

Packages

No packages published

Languages