Sparky983 / spark-test

A fluent testing and assertions library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spark Test

Version Coverage Commit activity License Apache

A fluent testing and assertions library.

📦 Installation

Replace {release} with the latest release version.

Version

The latest developmental version can be found in the gradle.properties file.

Gradle (Kotlin DSL)

repositories {
    maven("https://repo.sparky983.me/releases")
}

dependencies {
    implementation("me.sparky983:spark-test:{release}")
}

Gradle (Groovy DSL)

repositories {
    maven {
        url "https://repo.sparky983.me/releases"
    }
}

dependencies {
    implementation "me.sparky983:spark-test:{release}"
}

Maven

<repositories>
    <repository>
        <id>sparky</id>
        <url>https://repo.sparky983.me/releases</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>me.sparky983</groupId>
        <artifactId>spark-test</artifactId>
        <version>{release}</version>
    </dependency>
</dependencies>

Example Tests

// static imports
given("some epic string")
        .noop()
        .then(startsWith("some"))
        .and(contains("epic"));

// standard
Given.given("some epic string")
        .noop()
        .then(Assertion.startsWith("some"))
        .and(Assertion.contains("epic"));
// with static imports
when(() -> Objects.requireNonNull(null))
        .then(throwsException(NullPointerException.class));

// standard
When.when(() -> Objects.requireNonNull(null))
        .then(Assertion.throwsException(NullPointerException.class))

Credit

This project was inspired by AssertJ.

About

A fluent testing and assertions library

License:MIT License


Languages

Language:Java 100.0%