@ArchTest not being recognized in Kotlin with Junit 5 #1281
Unanswered
MarkVaughn
asked this question in
Q&A
Replies: 1 comment 1 reply
-
You don't need The following works for me: build.gradle.ktsplugins {
kotlin("jvm") version "1.9.23"
}
repositories {
mavenCentral()
}
dependencies {
testImplementation("com.tngtech.archunit:archunit-junit5:1.2.1")
}
tasks.named<Test>("test") {
useJUnitPlatform()
} SDKArchitectureTest.ktimport com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAPackage
import com.tngtech.archunit.junit.AnalyzeClasses
import com.tngtech.archunit.junit.ArchTest
import com.tngtech.archunit.lang.conditions.ArchConditions.dependOnClassesThat
import com.tngtech.archunit.lang.conditions.ArchConditions.not
import com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes
@AnalyzeClasses(packages = ["com.foo"])
internal class SDKArchitectureTest {
@ArchTest
val `apis can not depend on impls` = classes().that().resideInAPackage("com.foo..api..")
.should(not(dependOnClassesThat(resideInAPackage("com.foo..impl.."))))
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When following the guide, I'm running into this error message:
When trying to run this test
But this style works fine
This is my dependencies gradle
Any ideas / advice appreciated. I feel like it must be something obvious I am missing
Beta Was this translation helpful? Give feedback.
All reactions