https://kotlinlang.org logo
#getting-started
Title
# getting-started
e

elect

03/04/2024, 10:23 AM
I'm using junit5 via
Copy code
testImplementation(kotlin("test"))
now I need the parameterizedTest Annotation present in
org.junit.jupiter:junit-jupiter-params
, is there a programmatic way to have its version in sync with the other components brought in by the previous line? At the moment I'm simply looking in the deps and manually appending the version (
5.10.0
atm)
j

Javier

03/04/2024, 10:27 AM
Why do you want them on sync?
e

elect

03/04/2024, 10:28 AM
because I assume otherwise things will screw up
am I wrong?
j

Javier

03/04/2024, 10:30 AM
I haven’t had any problem using the last version of jupiter.
e

elect

03/04/2024, 10:30 AM
apparently me neither so far, but I've a feeling this might bite me back in the next future
s

Sam

03/04/2024, 10:38 AM
If you're worried about keeping things in sync you can always apply the junit BOM:
Copy code
testImplementation(platform("org.junit:junit-bom:5.10.0"))
e

elect

03/04/2024, 10:40 AM
yeah, but this way I'm weighing in with 5.10.0 myself, it's a perfectly legit solution, don't get me wrong, but I was wondering if there was a (quick) way to align to whatever brought by
kotlin("test")
but I guess I'll end up doing that, thanks!
k

Klitos Kyriacou

03/04/2024, 10:47 AM
If you are not actually using the
kotlin.test
framework, why are you importing the JUnit framework as a transitive dependency when you actually want to use it directly? Currently you've got:
Copy code
testImplementation(kotlin("test"))
and if you check what the
kotlin
function call does, you'll see that the above is the same as:
Copy code
testImplementation("org.jetbrains.kotlin:kotlin-test")
which gets an unspecified (typically latest) version of the
kotlin-test
dependency, which transitively pulls in an old version of JUnit. If you want JUnit, get it directly.
e

elect

03/04/2024, 10:48 AM
I see it's actually pulling 5.10.0