Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
library of matchers for building test expressions in Kotlin
Kotlin
tree: 0c2bbbfa5e

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
.gitignore
LICENSE.TXT
README.md
pom.xml

README.md

KATCHERS

library of matchers for building test expressions in Kotlin

Introduction

Katchers is using Kotlin infix notation to provide a domain specific language (DSL) for expressing assertions in tests using the word should.

Usage

1. Import import org.katchers.*

2. Write assertions 1 should be equal 1

Syntax

Every matcher expression starts with a result we want to validate, followed by should, a verb(i.e.: be, have, contain ...), matchfunction(depends on type of result and verb we are using) and expected value(depends on matchfunction).

<result|object> should <verb> <matchfunction> <expected>

Negation of verbs

Every verb can be negated by ! operator

1 should !be equal 2

List of katchers

Any

Any matchers may be used on any type of object.

be | !be equal

equal matchfunction should only be used on types, that implement equals function correctly

1 should be equal 1   //✔
2 should !be equal 1  //✔
"string" should be equal "string" //✔
"string" should be equal "str"  //✘

be | !be any

String

Function

Something went wrong with that request. Please try again.