All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.com.bkahlert.kommons.test.RootCauseKtTest.kt Maven / Gradle / Ivy

package com.bkahlert.kommons.test

import io.kotest.matchers.should
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeInstanceOf
import kotlin.test.Test

class RootCauseKtTest {

    @Test fun root_cause() = testAll(
        IllegalArgumentException("error message"),
        IllegalStateException(IllegalArgumentException("error message")),
        RuntimeException(IllegalStateException(IllegalArgumentException("error message"))),
        Error(RuntimeException(IllegalStateException(IllegalArgumentException("error message")))),
        RuntimeException(Error(RuntimeException(IllegalStateException(IllegalArgumentException("error message"))))),
    ) { ex ->
        ex.rootCause should {
            it.shouldBeInstanceOf()
            it.message shouldBe "error message"
        }
        ex.shouldHaveRootCauseInstanceOf()
        ex.shouldHaveRootCauseMessage("error message")
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy