Skip to content

Checks

assertk-lint ships 14 issues across 11 detectors. All detectors run only against Kotlin test sources.

Errors

These are the only checks that fire as Severity.ERROR. They flag patterns where the surrounding test will silently pass even though it shouldn't.

Issue ID What it flags Quick fix
UnusedAssertkAssertion An assertThat(...) chain that never has an assertion called on it Partial — for null/equality/is-check subjects
AssertThatEqualsUsage equals() called on an assertk.Assert receiver (returns a Boolean, never asserts) Yes

Warnings (on by default)

Issue ID What it flags Quick fix
TestFrameworkAssertionUse JUnit 4 / JUnit 5 / kotlin.test assertion calls JUnit 4 + kotlin.test
KotlinAssertionUse kotlin.assert(...) in tests Yes
NullComparisonAssertion assertThat(x == null) / assertThat(x != null) Yes
EqualityComparisonAssertion assertThat(a == b) / assertThat(a != b) Yes
CollectionSizeAssertion assertThat(list.size).isEqualTo(n) — use hasSize(n) Yes
UseIndexAssertion assertThat(list[i]) — use assertThat(list).index(i) Yes
MapValueAssertion assertThat(map[k]) — use assertThat(map).key(k) Yes
KeySetPresentAssertion assertThat(map.keys).contains(k) — use key(k) Yes
KeySetAbsentAssertion assertThat(map.keys).doesNotContain(k) — use doesNotContainKey(k) Yes
TryCatchAssertion A try { ... } catch { assertThat(e)... } block whose only purpose is exception assertion — use assertFailure No

Opt-in

Off by default; turn them on in lint.xml (see Configuration) when your project is committed to a single assertion library.

Issue ID What it flags Quick fix
AssertJUse AssertJ assertion calls in Kotlin tests No
GoogleTruthUse Google Truth assertion calls in Kotlin tests No

How to read each page

Every check page lists:

  • Issue ID — the stable identifier you'd put in lint.xml, @SuppressLint(...), or the IDE.
  • Severity / Category / Default — from the detector's Issue.create(...).
  • Why — the rationale and the assertk equivalent.
  • Example — tabs showing the flagged code and the preferred form.
  • Quick fix — whether the IDE can mechanically rewrite for you.
  • Source — a link to the detector implementation on GitHub.