Skip to content

Commit

Permalink
[Java] Run Mockito as Agent, i.e. fix the following warning.
Browse files Browse the repository at this point in the history
BufferUtilTest > freeIsANoOpIfDirectBufferContainsNonDirectByteBuffer() STANDARD_ERROR
    Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build what is described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3
  • Loading branch information
vyazelenko committed Nov 11, 2024
1 parent 3134822 commit 8109ba3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,15 @@ project(':agrona') {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

def mockitoAgent = configurations.create('mockitoAgent') { transitive = false }
mockitoAgent.withDependencies {it.add(libs.mockito.get()) }

tasks {
test {
jvmArgs("-javaagent:${mockitoAgent.asPath}")
}
}

def generatedDir = file("${layout.buildDirectory.get()}/generated-src")
sourceSets {
generated {
Expand Down

0 comments on commit 8109ba3

Please sign in to comment.