Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 733 Bytes

BasicAssertions.md

File metadata and controls

46 lines (33 loc) · 733 Bytes

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!")