View on GitHub

Kluent

Fluent Assertion-Library for Kotlin

Basic assertions

This assertions are available for all objects:

Testing for equality

anObject shouldBeEqualTo anotherObject
anObject shouldNotBeEqualTo anotherObject

Testing for referential equality

anObject shouldBe anObject
anObject shouldNotBe anotherObject

Testing for subtypes

anObject shouldBeInstanceOf Any::class
anObject shouldNotBeInstanceOf Int::class

Test for nullability

anObject.shouldBeNull()
anObject.shouldNotBeNull()

Testing booleans

isMale.shouldBeTrue()
isMale.shouldBeFalse()
isMale.shouldNotBeTrue()
isMale.shouldNotBeFalse()

Failing with a message

fail("You did not know the airspeed velocity of an unladen swallow!")