Skip to content

Use the JUnit assertions the project actually has - #18

Merged
bojieli merged 1 commit into
mainfrom
fix-kotlin-test-imports
Aug 25, 2026
Merged

Use the JUnit assertions the project actually has#18
bojieli merged 1 commit into
mainfrom
fix-kotlin-test-imports

Conversation

@bojieli

@bojieli bojieli commented Aug 25, 2026

Copy link
Copy Markdown
Owner

What broke

Two Kotlin test files I added in #9 and #10 import kotlin.test, which is not on this project's test classpath. junit:junit:4.13.2 is the only test dependency and every other Kotlin test imports org.junit.Assert.

e: TruncationGuardTest.kt:3:15 Unresolved reference 'test'.
e: TokenUsageTest.kt:23:9 Unresolved reference 'assertEquals'.

That broke the Android job on main, and therefore on every open pull request — including #12, which is documentation-only.

Why I shipped it

I wrote those files without compiling them, because I had it recorded that Android could only be built in CI. That is wrong. ./gradlew --offline builds and runs the full suite on a developer machine in seconds:

BUILD SUCCESSFUL
235 tests, 0 failures

Verified there before this commit. The note that said otherwise has been corrected.

The fix

Imports only — the assertions themselves are unchanged and the JUnit4 overloads resolve without edits.

🤖 Generated with Claude Code

https://claude.ai/code/session_015XKX6zEAGiZFE5wAxJgYbV

Two test files I added imported `kotlin.test`, which is not on this
project's test classpath — `junit:junit:4.13.2` is the only test dependency
and every other Kotlin test imports `org.junit.Assert`. They compiled
nowhere and broke the Android job on main, and therefore on every open pull
request, including a documentation-only one.

I wrote them without compiling because I had it recorded that Android could
only be built in CI. That is wrong: `./gradlew --offline` builds and runs
the full 235-test suite on this machine in seconds. Verified there before
this commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015XKX6zEAGiZFE5wAxJgYbV
@bojieli
bojieli merged commit eb74a83 into main Aug 25, 2026
13 checks passed
@bojieli
bojieli deleted the fix-kotlin-test-imports branch August 25, 2026 10:02
bojieli added a commit that referenced this pull request Aug 25, 2026
The same mistake as the two files fixed in #18, caught before merging this
time: kotlin.test is not on this project's test classpath. JUnit4 also
wants a delta on a double comparison and puts the message first, so those
are corrected too. Verified with ./gradlew --offline :app:testDebugUnitTest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015XKX6zEAGiZFE5wAxJgYbV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant