Hamkrest - Hamcrest for Kotlin

An implementation of Hamcrest to take advantage of Kotlin language features.

Kotlin Build Status Maven Central

Note: as of version 1.4.0.0, you must add kotlin-reflect to the classpath to use Hamkrest’s reflective features.

Getting Started

Add Hamkrest as a dependency of your project. Hamkrest is distributed via Maven Central.

Import matchers from com.natpryce.hamkrest. E.g. a quick way to get started is to import com.natpryce.hamkrest.* and then use IntelliJ to optimise imports when you’re done.

If you’re using Hamkrest for assertions, import com.natpryce.hamkrest.assertion.assertThat

Now you can make assertions about values using matchers:

assertThat(thisName, equalTo("Alice"))
assertThat(thatName, equalTo("Bob"))

… and so forth

More Information

compile "com.natpryce:hamkrest:1.7.0.0"

Related Libraries

expekt

BDD assertion library for Kotlin

Last updated 3 mins ago

assertk

assertions for kotlin inspired by assertj

Last updated 3 mins ago

atrium

An assertion library for Kotlin

Last updated 3 mins ago

hamkrest

Hamcrest for Kotlin

Last updated 3 mins ago

mockito-kotlin

Using Mockito with Kotlin

Last updated 3 mins ago