Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.rosomack:kluent:1.34'
}
dependencies {
implementation("com.github.rosomack:kluent:1.34")
}
<dependency>
<groupId>com.github.rosomack</groupId>
<artifactId>kluent</artifactId>
<version>1.34</version>
</dependency>
libraryDependencies += "com.github.rosomack" % "kluent" % "1.34"
:dependencies [[com.github.rosomack/kluent "1.34"]]
Kluent is a "Fluent Assertions" library written specifically for Kotlin.
It uses the Infix-Notations and Extension Functions of Kotlin to provide a fluent wrapper around the JUnit-Asserts and Mockito.
Kluent is hosted here at jcenter
Kluent-Android is hosted here at jcenter
Replace {version} with the current version
dependencies {
testImplementation 'org.amshove.kluent:kluent:{version}'
// for Android:
testImplementation 'org.amshove.kluent:kluent-android:{version}'
}
Replace {version} with the current version
<dependency>
<groupId>org.amshove.kluent</groupId>
<artifactId>kluent</artifactId>
<version>{version}</version>
<type>pom</type>
</dependency>
More examples can be seen on the Site or in the tests.
"hello" shouldEqual "hello"
"hello" shouldNotEqual "world"
val alice = Person("Alice", "Bob")
val jon = Person("Jon", "Doe")
val list = listOf(alice, jon)
list shouldContain jon
val stub = mock(Database::class)
val bob = Person("Bob", "Guy")
When calling stub.getPerson() itReturns bob
Every method that is included in Kluent also has a "backtick version", to make it feel more like a describing sentence.
Some examples:
"hello" `should equal` "hello"
"hello" `should not equal` "world"