You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running ./gradlew quarkusIntTest or ./gradlew testNative alongside mockito or quarkus-mockk, the following error is thrown:
quarkus-mockk
java.lang.NoSuchMethodException: io.quarkiverse.test.junit.mockk.internal.SetMockkMockAsBeanMockCallback.beforeEach(io.quarkus.test.junit.callback.QuarkusTestMethodContext)
at java.base/java.lang.Class.getMethod(Class.java:2227)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeCallbacks(AbstractTestWithCallbacksExtension.java:153)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeBeforeEachCallbacks(AbstractTestWithCallbacksExtension.java:76)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeBeforeEachCallbacks(AbstractTestWithCallbacksExtension.java:72)
at io.quarkus.test.junit.QuarkusIntegrationTestExtension.beforeEach(QuarkusIntegrationTestExtension.java:113)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachCallbacks$2(TestMethodTestDescriptor.java:166)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$6(TestMethodTestDescriptor.java:202)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:202)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachCallbacks(TestMethodTestDescriptor.java:165)
...
Suppressed: java.lang.NoSuchMethodException: io.quarkiverse.test.junit.mockk.internal.ResetMockkMocksCallback.afterEach(io.quarkus.test.junit.callback.QuarkusTestMethodContext)
at java.base/java.lang.Class.getMethod(Class.java:2227)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeCallbacks(AbstractTestWithCallbacksExtension.java:153)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeAfterEachCallbacks(AbstractTestWithCallbacksExtension.java:88)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeAfterEachCallbacks(AbstractTestWithCallbacksExtension.java:80)
at io.quarkus.test.junit.QuarkusIntegrationTestExtension.afterEach(QuarkusIntegrationTestExtension.java:86)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAfterEachCallbacks$12(TestMethodTestDescriptor.java:260)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAllAfterMethodsOrCallbacks$13(TestMethodTestDescriptor.java:276)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAllAfterMethodsOrCallbacks$14(TestMethodTestDescriptor.java:276)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeAllAfterMethodsOrCallbacks(TestMethodTestDescriptor.java:275)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeAfterEachCallbacks(TestMethodTestDescriptor.java:259)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:144)
... 64 more
mockito
java.lang.NoSuchMethodException: io.quarkus.test.junit.mockito.internal.SetMockitoMockAsBeanMockCallback.beforeEach(io.quarkus.test.junit.callback.QuarkusTestMethodContext)
at java.base/java.lang.Class.getMethod(Class.java:2227)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeCallbacks(AbstractTestWithCallbacksExtension.java:153)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeBeforeEachCallbacks(AbstractTestWithCallbacksExtension.java:76)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeBeforeEachCallbacks(AbstractTestWithCallbacksExtension.java:72)
at io.quarkus.test.junit.QuarkusIntegrationTestExtension.beforeEach(QuarkusIntegrationTestExtension.java:113)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachCallbacks$2(TestMethodTestDescriptor.java:166)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$6(TestMethodTestDescriptor.java:202)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:202)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachCallbacks(TestMethodTestDescriptor.java:165)
...
Suppressed: java.lang.NoSuchMethodException: io.quarkus.test.junit.mockito.internal.ResetMockitoMocksCallback.afterEach(io.quarkus.test.junit.callback.QuarkusTestMethodContext)
at java.base/java.lang.Class.getMethod(Class.java:2227)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeCallbacks(AbstractTestWithCallbacksExtension.java:153)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeAfterEachCallbacks(AbstractTestWithCallbacksExtension.java:88)
at io.quarkus.test.junit.AbstractTestWithCallbacksExtension.invokeAfterEachCallbacks(AbstractTestWithCallbacksExtension.java:80)
at io.quarkus.test.junit.QuarkusIntegrationTestExtension.afterEach(QuarkusIntegrationTestExtension.java:86)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAfterEachCallbacks$12(TestMethodTestDescriptor.java:260)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAllAfterMethodsOrCallbacks$13(TestMethodTestDescriptor.java:276)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeAllAfterMethodsOrCallbacks$14(TestMethodTestDescriptor.java:276)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeAllAfterMethodsOrCallbacks(TestMethodTestDescriptor.java:275)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeAfterEachCallbacks(TestMethodTestDescriptor.java:259)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:144)
... 64 more
This is my build.gradle file
plugins {
id 'org.jetbrains.kotlin.jvm' version "1.7.21"
id "org.jetbrains.kotlin.plugin.allopen" version "1.7.21"
id 'io.quarkus'
id "org.jlleitschuh.gradle.ktlint" version "11.0.0"
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation 'io.quarkiverse.loggingjson:quarkus-logging-json:2.0.0'
implementation 'io.quarkus:quarkus-opentelemetry'
implementation 'io.quarkus:quarkus-smallrye-openapi'
implementation 'io.quarkus:quarkus-hibernate-validator'
implementation 'io.quarkus:quarkus-mongodb-panache'
implementation 'io.quarkus:quarkus-smallrye-health'
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-kotlin'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'io.quarkus:quarkus-arc'
implementation("io.quarkus:quarkus-resteasy-reactive-jackson")
testImplementation "com.google.truth:truth:1.1.3"
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.rest-assured:rest-assured")
testImplementation("io.rest-assured:kotlin-extensions")
testImplementation 'io.quarkiverse.mockk:quarkus-junit5-mockk:1.1.1'
}
group 'br.com.straloo'
version '1.0.0-SNAPSHOT'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
test {
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
}
allOpen {
annotation("javax.ws.rs.Path")
annotation("javax.enterprise.context.ApplicationScoped")
annotation("io.quarkus.test.junit.QuarkusTest")
}
compileKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17
kotlinOptions.javaParameters = true
}
compileTestKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17
}
Removing io.quarkiverse.mockk:quarkus-junit5-mockk solves the problem.
It is important to highlight that the tested class does not use this library.
This is the Test:
package br.com.straloo.rocky.presentation
import br.com.straloo.rocky.domain.ExerciseExecutionIn
import br.com.straloo.rocky.domain.SequenceIn
import com.mongodb.client.MongoClients
import io.quarkus.test.junit.QuarkusIntegrationTest
import io.restassured.http.ContentType
import io.restassured.module.kotlin.extensions.Given
import io.restassured.module.kotlin.extensions.Then
import io.restassured.module.kotlin.extensions.When
import org.hamcrest.Matchers.notNullValue
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
@QuarkusIntegrationTest
class SequenceControllerTest {
private val URI = "mongodb://localhost:27017"
private val client = MongoClients.create(URI)
val db = client.getDatabase("rocky")
@BeforeEach
fun reset() {
client.listDatabases().forEach {
val dbName = it["name"] as String
if (dbName != "admin") {
client.getDatabase(dbName).drop()
}
}
}
@Test
fun whenSubmitsAnSequence_shouldReturnIt() {
val sequenceIn = SequenceIn(
"artrose",
"A",
listOf(
ExerciseExecutionIn(
"63a79e7999782320906daa76",
15,
10,
3
)
)
)
Given {
contentType(ContentType.JSON)
body(sequenceIn)
}.When {
post("/sequences")
}.Then {
statusCode(200)
body("id", notNullValue())
}
}
}
The text was updated successfully, but these errors were encountered:
When running
./gradlew quarkusIntTest
or./gradlew testNative
alongside mockito or quarkus-mockk, the following error is thrown:quarkus-mockk
mockito
This is my
build.gradle
fileRemoving
io.quarkiverse.mockk:quarkus-junit5-mockk
solves the problem.It is important to highlight that the tested class does not use this library.
This is the Test:
The text was updated successfully, but these errors were encountered: