test(arch): keep the alarm engine free of Android

The engine and the domain stay plain Kotlin, which is the only reason the
DST, skip and snooze behaviour can be pinned by 326 JVM tests instead of an
emulator. That is worth a test that fails the build when it stops being true.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-11 16:05:25 +02:00
co-authored by Claude Opus 5
parent bf511b47d7
commit c0de363db5
@@ -46,6 +46,9 @@ class ArchitectureRulesTest {
"TimerEntity",
"WorldClockEntity",
"LapEntity",
"AlarmStateEntity",
"AlarmStateDao",
"AlarmStateMapper",
"AlarmDao",
"TimerDao",
"WorldClockDao",
@@ -66,4 +69,21 @@ class ArchitectureRulesTest {
assertThat(offenders).isEmpty()
}
@Test
fun `the alarm engine and its pure neighbours stay free of Android types`() {
val jvmTestable = kotlinSources.filter { file ->
val path = file.invariantSeparatorsPath
path.contains("de/jeanlucmakiola/clockula/domain/alarm/") ||
path.endsWith("de/jeanlucmakiola/clockula/alarm/AlarmEngine.kt") ||
path.endsWith("de/jeanlucmakiola/clockula/alarm/AlarmResolver.kt") ||
path.contains("de/jeanlucmakiola/clockula/system/")
}
val offenders = jvmTestable.filter { file ->
file.readLines().any { it.startsWith("import android.") || it.startsWith("import androidx.") }
}.map { it.invariantSeparatorsPath }
assertThat(offenders).isEmpty()
}
}