Kotools Assert is a lightweight assertions library for Kotlin

Overview

Kotools Assert

Maven Central Kotlin

Kotools Assert is a lightweight assertions library for Kotlin.

{ throw RuntimeException() } assertFails("Should fail") { throw Exception() } assertFails ("Should fail with RuntimeException") { throw RuntimeException() }">
1 assertEquals 1
1.assertEquals(1, "1 should equal 1")
1.assertEquals(1) { "$this should be equal to $it" }

2 assertNotEquals 0
2.assertNotEquals(0, "2 shouldn't be equal to 0")
2.assertNotEquals(0) { "$this shouldn't be equal to $it" }

assertNull { null }
assertNull("result should be null") { null }
null.assertNull()
null assertNull "result should be null"
null assertNull { "result should be null" }

assertNotNull { 3 }
assertNotNull("result shouldn't be null") { 3 }
3.assertNotNull()
3 assertNotNull "result shouldn't be null"
3 assertNotNull { "result shouldn't be null" }

assertFails { throw Exception() }
assertFails<RuntimeException> { throw RuntimeException() }
assertFails("Should fail") { throw Exception() }
assertFails<RuntimeException>("Should fail with RuntimeException") {
    throw RuntimeException()
}

Installation

Gradle

Kotlin DSL

testImplementation("io.github.kotools:assert:1.1.0")

Groovy DSL

testImplementation 'io.github.kotools:assert:1.1.0'

Maven

<dependency>
    <groupId>io.github.kotoolsgroupId>
    <artifactId>assertartifactId>
    <version>1.1.0version>
    <scope>testscope>
dependency>

Documentation

Latest documentation of Kotools Assert is available here.

Contributing

Feel free to contribute to the project with issues and pull requests.

License

This project is licensed under the MIT License.

Comments
  • Release version 3.0.0-alpha

    Release version 3.0.0-alpha

    Issues of this new version should be done before resolving this issue.

    Checklist

    • [x] Upgrade the application's version.
    • [x] Create a pre-release on the repository.
    • [x] Test this version in a sample project.
    release 
    opened by LVMVRQUXL 3
  • Deprecated declarations in `io.github.kotools.assert`

    Deprecated declarations in `io.github.kotools.assert`

    Description

    Remove deprecated declarations in the package io.github.kotools.assert.

    This is a breaking change! 🔥

    Checklist

    • [x] Remove deprecations.
    • [x] Update Work in progress section in changelog.
    enhancement 
    opened by LVMVRQUXL 3
  • New assertions

    New assertions

    Description

    Implement new assertions corresponding to the existing ones in the package kotools.assert, and deprecate the old ones.

    Checklist

    • [x] Implement boolean assertions (assertTrue and assertFalse).
    • [x] Implement nullability assertions (assertNull and assertNotNull) and deprecate the old ones.
    • [x] Implement equality assertions (assertEquals and assertNotEquals) and deprecate the old ones.
    • [x] Implement failure assertions (assertFails, assertFailsWith and assertPass) and deprecate the old ones.
    • [x] Update Work in progress section in changelog.
    enhancement 
    opened by LVMVRQUXL 2
  • Workflow improvements

    Workflow improvements

    Description

    Improve the integration & delivery workflow and the deployment workflow by splitting jobs for each platforms. For example, in the integration & delivery workflow, we should have a job for integrating changes targetting the JVM platform, then another job for integrating changes targetting the JS platform...

    Checklist

    • [ ] Improve the integration & delivery workflow.
    • [ ] Improve the deployment workflow.
    automation 
    opened by LVMVRQUXL 1
  • Fix delivery of Native publications

    Fix delivery of Native publications

    Description

    No artifact was published in the version 3.0.1 for macOS and Windows. Fix the integration & delivery workflow and the deployment workflow for delivering on the right OS.

    Checklist

    • [x] Fix the integration & delivery workflow.
    • [x] Fix the deployment workflow.
    • [x] Update Work in progress section in changelog.
    bug native 
    opened by LVMVRQUXL 1
  • Release version 3.0.2

    Release version 3.0.2

    Issues of this new version should be done before resolving this issue.

    Checklist

    • [x] Upgrade the application's version.
    • [x] Close and release artifacts on Maven Central.
    • [x] Update version in readme and add version in changelog.
    • [x] Create a release on the repository.
    release 
    opened by LVMVRQUXL 1
  • `T.assertNotEquals(block: () -> T)` function

    `T.assertNotEquals(block: () -> T)` function

    Description

    Create a new T.assertNotEquals(block: () -> T) function asserting that this value is not equal to the result of calling the block function.

    Checklist

    • [ ] Implement.
    • [ ] Test.
    • [ ] Refactor.
    • [ ] Update Work in progress section in changelog.
    enhancement common 
    opened by LVMVRQUXL 1
  • `T.assertEquals(block: () -> T)` function

    `T.assertEquals(block: () -> T)` function

    Description

    Create a new T.assertEquals(block: () -> T) function asserting that this value equals the result of calling the block function.

    Checklist

    • [ ] Implement.
    • [ ] Test.
    • [ ] Refactor.
    • [ ] Update Work in progress section in changelog.
    enhancement common 
    opened by LVMVRQUXL 1
  • Release version 3.0.1

    Release version 3.0.1

    Issues of this new version should be done before resolving this issue.

    Checklist

    • [x] Upgrade the application's version.
    • [x] Close and release artifacts on Maven Central.
    • [x] Update version in readme and add version in changelog.
    • [x] Create a release on the repository.
    release 
    opened by LVMVRQUXL 1
  • Versioning annotations

    Versioning annotations

    Description

    In the @SinceKotoolsAssert annotation, we should keep the first version of Kotools Assert where a declaration has appeared independently of the platform.

    Checklist

    • [x] Fix.
    • [x] Test locally.
    • [x] Update Work in progress section in changelog.
    bug common 
    opened by LVMVRQUXL 1
  • Improve Gradle's build script

    Improve Gradle's build script

    opened by LVMVRQUXL 1
Releases(v3.0.2)
  • v3.0.2(Sep 10, 2022)

  • v3.0.1(Sep 9, 2022)

  • v3.0.0(Sep 7, 2022)

    Global changes

    Added

    Support for JS and Native platforms (#21).

    Removed

    Deprecated assertions in the io.github.kotools.assert package (#19).

    All platforms

    Added

    The functions assertTrue, assertFalse, assertEquals, assertNotEquals, assertFails, assertFailsWith, assertNull and assertNotNull are now available on all platforms. These assertions were only available for the JVM platform in the previous version (#21).

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Aug 3, 2022)

    Added

    • Create and apply the @SinceKotoolsAssert annotation on every declaration (#16).
    • Add boolean, nullability, equality and failure assertions in the kotools.assert package (#15).
    • Add @Test and @Nested annotations (#20).

    Deprecated

    Deprecate nullability, equality and failure assertions in the io.github.kotools.assert package (#15).

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Apr 11, 2022)

  • v1.2.0(Apr 9, 2022)

    Changed

    Split specific failure assertions assertFailsWith from untyped failure assertions assertFails (#5).

    Deprecated

    Equality and nullability assertions with lazy messages (#5).

    Removed

    Default messages from equality assertions (#10).

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Feb 12, 2022)

  • v1.0.0(Feb 11, 2022)

Owner
Kotools
Libraries for elegant programming with Kotlin.
Kotools
A lightweight Kotlin library which converts images to PixelArt in Android.

PixelArtImageView PixelArtImageView is a lightweight library used to convert standalone images into pixel art. The view extends ImageView behaviour an

Josh Owen 2 May 15, 2022
A lightweight library for requesting and consuming Activity Results using coroutines.

SuspendActivityResult A lightweight library for requesting and consuming Activity Results using coroutines, it's usage is as simple as: val uri = Acti

Hicham Boushaba 71 Dec 23, 2022
A simple, lightweight and powerful field validation library for Android.

Convalida Convalida - (Italian for "validation") Convalida is a simple, lightweight and powerful field validation library for Android. Documentation G

Wellington Costa 203 Nov 18, 2022
A lightweight tool for managing and building Kotlin projects.

kpm kpm (Kotlin Project Manager) is a lightweight tool for managing and building Kotlin projects. What is kpm? Essentially, kpm is going to be a light

Conor Byrne 5 Apr 23, 2022
A simple, lightweight, non-bloated redis client for kotlin and other JVM languages

rekt is a lightweight, non-bloated redis client, primarily written for the kotlin programming language, while also supporting other JVM-based languages, such as Java, Scala, and obviously way more.

Patrick 8 Nov 2, 2022
A pragmatic lightweight dependency injection framework for Kotlin developers.

A pragmatic lightweight dependency injection framework for Kotlin developers. Koin is a DSL, a light container and a pragmatic API

insert-koin.io 11 Dec 14, 2022
A lightweight Trakt API.

This library is a lightweight Trakt API. It supports Swift, Kotlin, and JavaScript by setting up as a Kotlin Multiplatform project.

Moviebase 6 Nov 1, 2022
☁️ cloud.sh is a lightweight self-hosted cloud for your home lab.

DISCLAIMER: cloud.sh is under development. We do not recommend you to use it in a production environment for now. The storage could be corrupted when

Quentin Guidée 13 Nov 24, 2022
XCore is a Open-Source , simple and lightweight API & Template for Android Apps.

XCore XCore is a Open-Source , simple and lightweight API & Template for Android Apps. Support XCore is compatible with Android Studio & Sketchware Pr

TherionRO 3 Dec 2, 2022
Small kotlin library for persisting _single instances_ of kotlin data classes

PerSista Small library for persisting single instances of kotlin data classes. NB: PerSista uses typeOf() internally which is marked as @ExperimentalS

Eric Donovan 5 Nov 13, 2022
FlowExt is a Kotlin Multiplatform library, that provides many operators and extensions to Kotlin Coroutines Flow

FlowExt | Kotlinx Coroutines Flow Extensions | Kotlinx Coroutines Flow Extensions. Extensions to the Kotlin Flow library | kotlin-flow-extensions | Coroutines Flow Extensions | Kotlin Flow extensions | kotlin flow extensions | Flow extensions

Petrus Nguyễn Thái Học 151 Jan 1, 2023
Repo: Programming problems with solutions in Kotlin to help avid Kotlin learners to get a strong hold on Kotlin programming.

Kotlin_practice_problems Repo: Programming problems with solutions in Kotlin to help avid Kotlin learners to get a strong hold on Kotlin programming.

Aman 0 Oct 14, 2021
Mocking for Kotlin/Native and Kotlin Multiplatform using the Kotlin Symbol Processing API (KSP)

Mockative Mocking for Kotlin/Native and Kotlin Multiplatform using the Kotlin Symbol Processing API (KSP). Installation Mockative uses KSP to generate

Mockative 121 Dec 26, 2022
Kotlin-oop - Repositório criado para ser utilizado pelo projeto de Kotlin OOP desenvolvido em Kotlin nas aulas feitas através da plataforma Alura.

Projeto React OOP Repositório criado para ser utilizado pelo projeto de Kotlin OOP desenvolvido em Kotlin nas aulas feitas através da plataforma Alura

Marcos Felipe 1 Jan 5, 2022
Kotlin-koans - Kotlin Koans are a series of exercises to get you familiar with the Kotlin Syntax

kotlin-koans-edu Kotlin Koans are a series of exercises to get you familiar with

null 1 Jan 11, 2022
🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

??The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

Rouse 1.3k Dec 30, 2022
Ksp-di-library - Small library for DI in KMM apps

DI-KSP Small library for DI in KMM apps. Uses KSP for processing DI annotations:

Anna Zharkova 3 Feb 6, 2022
An library to help android developers working easly with activities and fragments (Kotlin version)

AFM An library to help android developer working easly with activities and fragments (Kotlin) Motivation Accelerate the process and abstract the logic

Massive Disaster 12 Oct 3, 2022
Kotlin Multiplatform String markup library

Thistle Kotlin multiplatform String markup library, inspired by SRML. Thistle is a common parser which produces an AST that can be rendered to a varie

Copper Leaf 52 Dec 30, 2022