Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException in @ParameterizedTest: Base Class from Different Class Loader #8251

Closed
schulzp opened this issue Mar 29, 2020 · 1 comment · Fixed by #9340
Closed

ClassCastException in @ParameterizedTest: Base Class from Different Class Loader #8251

schulzp opened this issue Mar 29, 2020 · 1 comment · Fixed by #9340
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@schulzp
Copy link
Contributor

schulzp commented Mar 29, 2020

Describe the bug
Running a @QuarkusTest fails with a java.lang.ClassCastException, see MWE.

Expected behavior
The tests passes.

Actual behavior
When using @ParameterizedTest with @MethodSource, see MWE, the test fails with the following exception:
java.lang.ClassCastException: class org.hamcrest.core.Is cannot be cast to class org.hamcrest.Matcher (org.hamcrest.core.Is is in unnamed module of loader 'app'; org.hamcrest.Matcher is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @7188af83)

However, if the test parameters are mapped manually (using a regular @Test) it passes.

To Reproduce
Steps to reproduce the behavior:

  1. Check out the MWE
  2. run ./mvnw verify

Configuration

# no properties are set explicitly

Environment (please complete the following information):

  • Output of uname -a or ver:
    Darwin Kernel Version 19.3.0; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
    
  • Output of java -version: 11.0.1, vendor: Oracle Corporation
  • Quarkus version or git rev: 1.3.1.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
    Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
    Java version: 11.0.1, vendor: Oracle Corporation, runtime: [...]
    Default locale: de_DE, platform encoding: UTF-8
    OS name: "mac os x", version: "10.15.3", arch: "x86_64", family: "mac"
    

Additional context
The behavior occurred when I upgraded quarkus from 1.2.1.Final to 1.3.0.Final/1.3.1.Final.

@schulzp schulzp added the kind/bug Something isn't working label Mar 29, 2020
@schulzp schulzp changed the title ClassCastException in Test: Base Class from Different Class Loader ClassCastException in @ParameterizedTest: Base Class from Different Class Loader Mar 29, 2020
@geoand geoand self-assigned this Mar 29, 2020
geoand added a commit to geoand/quarkus that referenced this issue Mar 29, 2020
@geoand
Copy link
Contributor

geoand commented Mar 29, 2020

The issue should be fixed by #8252

geoand added a commit to geoand/quarkus that referenced this issue May 15, 2020
This is done by deep-cloning the objects into the TCCL
before actually passing them to the test

Fixes quarkusio#8251, fixes quarkusio#8703, fixes quarkusio#8978
geoand added a commit to geoand/quarkus that referenced this issue May 15, 2020
This is done by deep-cloning the objects into the TCCL
before actually passing them to the test

Fixes quarkusio#8251, fixes quarkusio#8703, fixes quarkusio#8978
geoand added a commit to geoand/quarkus that referenced this issue May 17, 2020
This is done by deep-cloning the objects into the TCCL
before actually passing them to the test

Fixes quarkusio#8251, fixes quarkusio#8703, fixes quarkusio#8978
@gsmet gsmet added this to the 1.5.0 milestone May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
3 participants