
Expressive, type-safe test assertion library offering chainable assertions for equality, types, nulls, collections, maps, enums; enforces rigorous code quality and complete branch coverage.
A Kotlin Multiplatform assertion/expection library designed to provide expressive, type-safe test assertions across all supported platforms.
Status: 🚧 Work in progress — the API is under active development and not yet published.
| Platform | Status |
|---|---|
| JVM | ✅ |
| iOS (arm64) | ✅ |
| iOS (simulatorArm64) | ✅ |
./gradlew build./gradlew checkThis will run code quality checks (detekt, ktlint) and code coverage verification (Kover).
Tests are written using testBalloon as the testing framework. Tests reside in the commonTest source set and should run across all supported platforms.
# Run all tests
./gradlew allTests
# Run JVM tests only
./gradlew jvmTestCode coverage is measured by Kover and aggregated across all modules. A verification rule enforces 100% branch coverage per class.
# Run coverage verification
./gradlew koverVerify
# Generate an HTML coverage report
./gradlew koverHtmlReportThe project enforces code quality through two tools, both integrated into the check lifecycle:
# Run all checks (tests + detekt + ktlint + kover)
./gradlew check
# Run only ktlint
./gradlew ktlintCheck
# Run only detekt
./gradlew detektUse expectThat to start an assertion on any value, then chain one or more assertions:
expectThat(42)
.isEqualTo(42)
expectThat("hello")
.isEqualTo("hello")
expectThat(listOf(1, 2, 3))
.isEqualTo(listOf(1, 2, 3))expectThat("hello")
.isA<String>()
expectThat(1L)
.isA<Number>()expectThat(null)
.isNull()expectThat(true)
.isTrue()
expectThat(false)
.isFalse()expectThat("")
.isEmpty()
expectThat("hello")
.trim()
.isNotEmpty()
.isNotBlank()
.hasLength(5)
expectThat("hello world")
.startsWith("hello")
.endsWith("world")
.contains("lo wo")
expectThat("Hello World")
.containsIgnoringCase("hello world")
expectThat("abc123")
.matches(Regex("[a-z]+\\d+"))
expectThat("Hello World")
.matchesIgnoringCase(Regex("hello world"))expectThat(2026)
.isGreaterThan(2025)
expectThat(3.14)
.isLessThan(4.0)
expectThat(12L)
.isGreaterThanOrEqualTo(12L)
.isLessThanOrEqualTo(12L)
expectThat(12)
.isIn(10..20)Assertions return the builder, so you can chain multiple checks on the same subject:
expectThat("hello")
.isA<String>()
.isEqualTo("hello")expectThat(Color.RED)
.isIn(Color.RED, Color.GREEN)
expectThat(Color.RED)
.name()
.isEqualTo("RED")
expectThat(Color.RED)
.ordinal()
.isEqualTo(1)expectThat(listOf(1, 2, 3))
.hasSize(3)
.size()
.isGreaterThan(2)
expectThat(listOf(1))
.single()
.isEqualTo(1)
expectThat(listOf(1, 2, 3))
.first()
.isEqualTo(1)
expectThat(listOf(1, 2, 3))
.last()
.isEqualTo(3)
expectThat(listOf(1, 2, 3))
.filter { it > 1 }
.hasSize(2)
expectThat(listOf("item1", "item2", "item3"))
.flatMap { it.toCharArray().toList() }
.filter { it.isDigit() }
.containsExactly('1', '2', '3')
expectThat(listOf(1, 2, 3))
.map { it * 2 }
.containsExactly(2, 4, 6)expectThat(mapOf(1 to "item1", 2 to "item2"))
.isNotEmpty()
.hasSize(3)
.containsKeys(1, 2)This library was inspired by Strikt, an assertion library for Kotlin. As Strikt seemingly became stale, Kotlin Expect was created as a modern Kotlin Multiplatform alternative. The project structure and API design are influenced by Strikt's approach to expressive, chainable assertions.
See CONTRIBUTING.md for guidelines on how to contribute.
This project is licensed under the MIT License.
A Kotlin Multiplatform assertion/expection library designed to provide expressive, type-safe test assertions across all supported platforms.
Status: 🚧 Work in progress — the API is under active development and not yet published.
| Platform | Status |
|---|---|
| JVM | ✅ |
| iOS (arm64) | ✅ |
| iOS (simulatorArm64) | ✅ |
./gradlew build./gradlew checkThis will run code quality checks (detekt, ktlint) and code coverage verification (Kover).
Tests are written using testBalloon as the testing framework. Tests reside in the commonTest source set and should run across all supported platforms.
# Run all tests
./gradlew allTests
# Run JVM tests only
./gradlew jvmTestCode coverage is measured by Kover and aggregated across all modules. A verification rule enforces 100% branch coverage per class.
# Run coverage verification
./gradlew koverVerify
# Generate an HTML coverage report
./gradlew koverHtmlReportThe project enforces code quality through two tools, both integrated into the check lifecycle:
# Run all checks (tests + detekt + ktlint + kover)
./gradlew check
# Run only ktlint
./gradlew ktlintCheck
# Run only detekt
./gradlew detektUse expectThat to start an assertion on any value, then chain one or more assertions:
expectThat(42)
.isEqualTo(42)
expectThat("hello")
.isEqualTo("hello")
expectThat(listOf(1, 2, 3))
.isEqualTo(listOf(1, 2, 3))expectThat("hello")
.isA<String>()
expectThat(1L)
.isA<Number>()expectThat(null)
.isNull()expectThat(true)
.isTrue()
expectThat(false)
.isFalse()expectThat("")
.isEmpty()
expectThat("hello")
.trim()
.isNotEmpty()
.isNotBlank()
.hasLength(5)
expectThat("hello world")
.startsWith("hello")
.endsWith("world")
.contains("lo wo")
expectThat("Hello World")
.containsIgnoringCase("hello world")
expectThat("abc123")
.matches(Regex("[a-z]+\\d+"))
expectThat("Hello World")
.matchesIgnoringCase(Regex("hello world"))expectThat(2026)
.isGreaterThan(2025)
expectThat(3.14)
.isLessThan(4.0)
expectThat(12L)
.isGreaterThanOrEqualTo(12L)
.isLessThanOrEqualTo(12L)
expectThat(12)
.isIn(10..20)Assertions return the builder, so you can chain multiple checks on the same subject:
expectThat("hello")
.isA<String>()
.isEqualTo("hello")expectThat(Color.RED)
.isIn(Color.RED, Color.GREEN)
expectThat(Color.RED)
.name()
.isEqualTo("RED")
expectThat(Color.RED)
.ordinal()
.isEqualTo(1)expectThat(listOf(1, 2, 3))
.hasSize(3)
.size()
.isGreaterThan(2)
expectThat(listOf(1))
.single()
.isEqualTo(1)
expectThat(listOf(1, 2, 3))
.first()
.isEqualTo(1)
expectThat(listOf(1, 2, 3))
.last()
.isEqualTo(3)
expectThat(listOf(1, 2, 3))
.filter { it > 1 }
.hasSize(2)
expectThat(listOf("item1", "item2", "item3"))
.flatMap { it.toCharArray().toList() }
.filter { it.isDigit() }
.containsExactly('1', '2', '3')
expectThat(listOf(1, 2, 3))
.map { it * 2 }
.containsExactly(2, 4, 6)expectThat(mapOf(1 to "item1", 2 to "item2"))
.isNotEmpty()
.hasSize(3)
.containsKeys(1, 2)This library was inspired by Strikt, an assertion library for Kotlin. As Strikt seemingly became stale, Kotlin Expect was created as a modern Kotlin Multiplatform alternative. The project structure and API design are influenced by Strikt's approach to expressive, chainable assertions.
See CONTRIBUTING.md for guidelines on how to contribute.
This project is licensed under the MIT License.