add Mockito
This commit is contained in:
parent
c3d3f8356e
commit
6ce71738f2
@ -15,11 +15,17 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
val mockitoAgent = configurations.create("mockitoAgent")
|
||||
|
||||
dependencies {
|
||||
// Use JUnit Jupiter for testing.
|
||||
testImplementation(libs.junit.jupiter)
|
||||
|
||||
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.
|
||||
@ -34,7 +40,13 @@ application {
|
||||
mainClass = "quality.software.Main"
|
||||
}
|
||||
|
||||
tasks.named<Test>("test") {
|
||||
// Use JUnit Platform for unit tests.
|
||||
useJUnitPlatform()
|
||||
}
|
||||
tasks {
|
||||
test {
|
||||
// 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]
|
||||
guava = "33.2.1-jre"
|
||||
junit-jupiter = "5.10.3"
|
||||
mockito = "5.14.0"
|
||||
|
||||
[libraries]
|
||||
guava = { module = "com.google.guava:guava", version.ref = "guava" }
|
||||
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