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

ParameterizedTest - CsvSource: can't resolve boolean input #3403

Closed
1 task
fuqua79 opened this issue Jul 26, 2023 · 1 comment
Closed
1 task

ParameterizedTest - CsvSource: can't resolve boolean input #3403

fuqua79 opened this issue Jul 26, 2023 · 1 comment

Comments

@fuqua79
Copy link

fuqua79 commented Jul 26, 2023

We just upgraded to Junit 5.10.0
We have @ParameterizedTest with @CsvSource.
In Junit 5.10.0 the conversion is more strict. (#3178) But in our tests we receive always a exception (see starcktrace). Could this be a bug ?

Our Test:

@CsvSource({
"true",
"false"
})
@ParameterizedTest
void shouldRun(boolean expectedValidationResult) {

assertTrue(expectedValidationResult);
}

StackTrace:

org.junit.jupiter.api.extension.ParameterResolutionException: Failed to resolve parameter [boolean arg0] in method [void ch.css.pendenzen.partner.adressen.telefonnummer.validate.TelefonnummerValidatorTest.shouldRun(boolean)]: 'java.lang.ClassLoader org.junit.platform.commons.util.ClassLoaderUtils.getClassLoader(java.lang.Class)'

 

            at org.junit.jupiter.engine.execution.ParameterResolutionUtils.resolveParameter(ParameterResolutionUtils.java:159)

            at org.junit.jupiter.engine.execution.ParameterResolutionUtils.resolveParameters(ParameterResolutionUtils.java:103)

            at org.junit.jupiter.engine.execution.ParameterResolutionUtils.resolveParameters(ParameterResolutionUtils.java:64)

            at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:84)

            at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)

            at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)

            at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)

            at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)

            at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.execute(NodeTestTask.java:226)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.execute(NodeTestTask.java:204)

            at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.execute(TestTemplateTestDescriptor.java:142)

            at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.lambda$execute$2(TestTemplateTestDescriptor.java:110)

            at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)

            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

            at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)

            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

            at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)

            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

            at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)

            at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)

            at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)

            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

            at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

            at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)

            at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)

            at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)

            at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)

            at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)

            at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)

            at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)

            at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)

            at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)

            at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)

            at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)

            at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)

            at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)

            at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)

            at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)

            at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.execute(TestTemplateTestDescriptor.java:110)

            at org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor.execute(TestTemplateTestDescriptor.java:44)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)

            at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)

            at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

            at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)

            at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)

            at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

            at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)

            at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)

            at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)

            at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)

            at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)

            at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)

            at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)

            at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)

            at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)

            at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)

            at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)

            at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)

            at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)

            at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)

            at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)

            at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)

            at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)

            at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)

            at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)

            at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)

            at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)

            at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)

            at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

Caused by: java.lang.NoSuchMethodError: 'java.lang.ClassLoader org.junit.platform.commons.util.ClassLoaderUtils.getClassLoader(java.lang.Class)'

            at org.junit.jupiter.params.converter.DefaultArgumentConverter.convert(DefaultArgumentConverter.java:96)

            at org.junit.jupiter.params.converter.DefaultArgumentConverter.convert(DefaultArgumentConverter.java:74)

            at org.junit.jupiter.params.ParameterizedTestMethodContext$Converter.resolve(ParameterizedTestMethodContext.java:235)

            at org.junit.jupiter.params.ParameterizedTestMethodContext.resolve(ParameterizedTestMethodContext.java:165)

            at org.junit.jupiter.params.ParameterizedTestParameterResolver.resolveParameter(ParameterizedTestParameterResolver.java:75)

            at org.junit.jupiter.engine.execution.ParameterResolutionUtils.resolveParameter(ParameterResolutionUtils.java:136)

            ... 99 more

Steps to reproduce

Context

  • Used versions (Jupiter/Vintage/Platform):
  • Build Tool/IDE:

Deliverables

  • ...
@marcphilipp
Copy link
Member

You seem to be using an old version of junit-platform-commons. Please align your dependencies to use 1.10.0 for all org.junit.platform and 5.10.0 for all other org.junit.* artifacts, e.g. using the junit-bom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants