Skip to content

Library containing reusable extensions and functions for Kotest

License

Notifications You must be signed in to change notification settings

opengood-aio/kotest-extensions

Repository files navigation

Kotest Extensions Library

Build Release CodeQL Codecov Release Version Maven Central License

Library containing reusable extensions and functions for Kotest

Compatibility

  • Java 21
  • Spring Boot 3

Setup

Add Dependency

Gradle

implementation("io.opengood.extensions:kotest-extensions:VERSION")

Maven

<dependency>
    <groupId>io.opengood.extensions</groupId>
    <artifactId>kotest-extensions</artifactId>
    <version>VERSION</version>
</dependency>

Note: See Release version badge above for latest version.

Features

Matchers

Map

  • Assert list of maps are equal ignoring specific keys:

    Example:

    import io.opengood.extensions.kotest.matcher
    
    val expected = listOf(
        mapOf("foo" to "bar"),
        mapOf("foo" to "baz")
    )
    
    val items = listOf(
        mapOf(
            "none" to "none",
            "foo" to "bar"
        ),
        mapOf(
            "none" to "none",
            "foo" to "baz"
        )
    )
    
    items.shouldBeEqualIgnoringKeys(expected, "none")
  • Assert map entries are equal:

    Example:

    import io.opengood.extensions.kotest.matcher
    
    fun makeEntry(key: String, value: String) = object : Map.Entry<String, String> {
        override val key: String = key
        override val value: String = value
    }
    
    val expected = makeEntry("foo", "bar")
    
    makeEntry("foo", "bar") shouldBeMapEntry expected

About

Library containing reusable extensions and functions for Kotest

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages