add Mockito
This commit is contained in:
parent
c3d3f8356e
commit
6ce71738f2
@ -15,11 +15,17 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val mockitoAgent = configurations.create("mockitoAgent")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Use JUnit Jupiter for testing.
|
// Use JUnit Jupiter for testing.
|
||||||
testImplementation(libs.junit.jupiter)
|
testImplementation(libs.junit.jupiter)
|
||||||
|
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||||
|
|
||||||
|
// Use Mockito for mocking.
|
||||||
|
// https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#mockito-instrumentation
|
||||||
|
testImplementation(libs.mockito)
|
||||||
|
mockitoAgent(libs.mockito) { isTransitive = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply a specific Java toolchain to ease working on different environments.
|
// Apply a specific Java toolchain to ease working on different environments.
|
||||||
@ -34,7 +40,13 @@ application {
|
|||||||
mainClass = "quality.software.Main"
|
mainClass = "quality.software.Main"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<Test>("test") {
|
tasks {
|
||||||
// Use JUnit Platform for unit tests.
|
test {
|
||||||
useJUnitPlatform()
|
// Use JUnit Platform for unit tests.
|
||||||
}
|
useJUnitPlatform()
|
||||||
|
|
||||||
|
// Mockito JDK21+ config
|
||||||
|
// https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#mockito-instrumentation
|
||||||
|
jvmArgs("-javaagent:${mockitoAgent.asPath}")
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,9 @@
|
|||||||
[versions]
|
[versions]
|
||||||
guava = "33.2.1-jre"
|
guava = "33.2.1-jre"
|
||||||
junit-jupiter = "5.10.3"
|
junit-jupiter = "5.10.3"
|
||||||
|
mockito = "5.14.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
guava = { module = "com.google.guava:guava", version.ref = "guava" }
|
guava = { module = "com.google.guava:guava", version.ref = "guava" }
|
||||||
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
|
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
|
||||||
|
mockito = { module = "org.mockito:mockito-core", version.ref = "mockito" }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user