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

Quarkus test with @ParameterizedTest and @MethodSource using List.subList does not work #28677

Closed
jakubbrzeski opened this issue Oct 19, 2022 · 2 comments · Fixed by #28680
Closed
Labels
area/testing kind/bug Something isn't working
Milestone

Comments

@jakubbrzeski
Copy link

jakubbrzeski commented Oct 19, 2022

Describe the bug

This is similar to #25413, #25027 and #24492.

When I provide arguments to @ParameterizedTest via @MethodSource and use list.subList(...), there is an error:

No converter available
---- Debugging information ----
message             : No converter available
type                : java.util.ImmutableCollections$SubList
converter           : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
message[1]          : Unable to make field private final java.util.ImmutableCollections$AbstractImmutableList java.util.ImmutableCollections$SubList.root accessible: module java.base does not "opens java.util" to unnamed module @76a3e297
-------------------------------
com.thoughtworks.xstream.converters.ConversionException: No converter available
---- Debugging information ----
message             : No converter available
type                : java.util.ImmutableCollections$SubList
converter           : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
message[1]          : Unable to make field private final java.util.ImmutableCollections$AbstractImmutableList java.util.ImmutableCollections$SubList.root accessible: module java.base does not "opens java.util" to unnamed module @76a3e297

Adding --add-opens java.base/java.lang=ALL-UNNAME etc. proposed in other issues does not work for me unfortunately.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

@QuarkusTest
public class ExampleTest {

    @ParameterizedTest
    @MethodSource("params")
    void testLists(List<Integer> ints) {
        assertTrue(true);
    }

    private static Stream<Arguments> params() {
        return Stream.of(
            Arguments.of(
                List.of(1, 2, 3).subList(1,2)
            )
        );
    }
}

Output of uname -a or ver

No response

Output of java -version

openjdk 17.0.3 (Temurin-17.0.3+7)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.12.3

Build tool (ie. output of mvnw --version or gradlew --version)

gradle 7.5.1

Additional information

No response

@jakubbrzeski jakubbrzeski added the kind/bug Something isn't working label Oct 19, 2022
geoand added a commit to geoand/quarkus that referenced this issue Oct 19, 2022
geoand added a commit that referenced this issue Oct 26, 2022
Include more kinds of lists in test parameter converter support
@quarkus-bot quarkus-bot bot added this to the 2.15 - main milestone Oct 26, 2022
tmihalac pushed a commit to tmihalac/quarkus that referenced this issue Oct 27, 2022
@gsmet gsmet modified the milestones: 2.15 - main, 2.14.0.Final Oct 28, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 28, 2022
@gsmet gsmet modified the milestones: 2.14.0.Final, 2.13.4.Final Oct 31, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 31, 2022
zakkak pushed a commit to zakkak/quarkus that referenced this issue Nov 15, 2022
@elmodeer
Copy link

elmodeer commented Mar 4, 2024

I am facing the same problem whenever there is a record class inside the arguments list.

---- Debugging information ----
cause-exception     : java.lang.UnsupportedOperationException
cause-message       : can't get field offset on a record class: private final java.lang.String com.**
class               : com.**
required-type       : com..**
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path                : /com..**
line number         : 2
version             : 1.4.20
-------------------------------

any ideas why is that ?

it also seems to be the same problem as this issue here, with the fix being to implement serializable. But this is shouldn't be the solution in my opinion.

@zakkak @gsmet

@zakkak
Copy link
Contributor

zakkak commented Mar 6, 2024

I am facing the same problem

It looks like a different problem to me.

it also seems to be the same problem as this issue #15892

That indeed looks like the same issue with yours, could you please provide any additional feedback you might have there instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants