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
The error is present only since the upgrade from 2.2.0.CR1 to 2.2.1.Final
If there is a @BeforeEach at the top level in a test with @Nested classes, only the first test runs through. The rest fail due to an IllegalArgumentException.
The error occurs from the second test on, no matter if multiple @Nested with one test each or one @Nested class with multiple tests.
Example multiple Nested
@QuarkusTest
public class NestedQuarkusTest {
@BeforeEach
void generalBeforeEach() {
}
@Nested
class Foo {
@Test
void check() {
Assertions.assertTrue(true);
}
}
@Nested
class Bar {
@Test
void check() {
Assertions.assertTrue(true);
}
}
}
Example one Nested with multiple tests
@QuarkusTest
public class OneNestedQuarkusTestWithBeforeEach {
@BeforeEach
void generalBeforeEach() {
}
@Nested
class Foo {
@Test
void checkA() {
Assertions.assertTrue(true);
}
@Test
void checkB() {
Assertions.assertTrue(true);
}
}
}
Expected behavior
@BeforeEach should be performed for each test and the tests above should pass.
Actual behavior
java.lang.IllegalArgumentException: object is not an instance of declaring class
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:1084)
at io.quarkus.test.junit.QuarkusTestExtension.interceptBeforeEachMethod(QuarkusTestExtension.java:905)
...
In io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:1084) the @BeforeEach method is invoked on the nested class instead of the "root class".
Describe the bug
The error is present only since the upgrade from
2.2.0.CR1
to2.2.1.Final
If there is a
@BeforeEach
at the top level in a test with@Nested
classes, only the first test runs through. The rest fail due to an IllegalArgumentException.The error occurs from the second test on, no matter if multiple
@Nested
with one test each or one@Nested
class with multiple tests.Example multiple Nested
Example one Nested with multiple tests
Expected behavior
@BeforeEach
should be performed for each test and the tests above should pass.Actual behavior
In
io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:1084)
the@BeforeEach
method is invoked on the nested class instead of the "root class".How to Reproduce?
Reproducer: https://github.com/vonatzigenc/reproducer-nested-quarkustest
Run tests:
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.2.1.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1
Additional information
No response
The text was updated successfully, but these errors were encountered: