Matchers test for some property, indicated by the name of the matcher, beyond simple equality. For example, a matcher may check whether a string is empty, or whether an integer is positive. In the Getting started section, we used the shouldBe assertion to check for equality. In fact, the shouldBe assertion also accepts a matcher that provides for more complicated assertions.
The idea behind the shouldBe naming convention is to lead to readable assertions, such as thisString shouldBe empty(). To further this goal, there is an equivalent of shouldBe, named should; with this, matchers such as thisString should mean that startWith("foo") could be read as natural language.
Many matchers are provided out of the box by KotlinTest, and each one checks for a specific property or condition. In the remainder of this section, we will cover some of the most fundamental matchers...