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
Describe the bug
I have a working test with a DefaultParameterTransformer (using Jackson). When I run this test in IntelliJ it succeeds. Although when running with Surefire, the test fails.
Output with Intellij:
Mapping '1.1.0' to 'java.lang.String'.
We wants a version: 1.1.0
Mapping '1.1.0' to 'nl.blue4it.stolwijk.sandbox.cucumber5.model.Version'.
We gets a version: Version{major=1, minor=1, patch=0}
1 Scenarios (1 passed)
2 Steps (2 passed)
0m0,513s
Output with Surefire:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running Version number check
Mapping '1.1.0' to 'java.lang.Object'.
We wants a version: 1.1.0
Mapping '1.1.0' to 'java.lang.Object'.
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.422 s <<< FAILURE! - in Version number check
[ERROR] User wants to use 1.1.0 as version. Time elapsed: 0.416 s <<< ERROR!
java.lang.ClassCastException: class java.lang.String cannot be cast to class nl.blue4it.stolwijk.sandbox.cucumber5.model.Version (java.lang.String is in module java.base of loader 'bootstrap'; nl.blue4it.stolwijk.sandbox.cucumber5.model.Version is in unna
med module of loader 'app')
Then("The user gets an {} version.", (Versionversion) -> {
System.out.println("We gets a version: " + version);
});
Java erases the parameter types of lambdas. So for the snippet above we use type-tools to fish that information out of the constant pool. This unfortunately type tools doesn't work on Java 12 yet.
Unless you're interested in fixing type-tools your best option is to use annotation based stepdefinitions from cucumber-java or oddly enough Kotlin.
Describe the bug
I have a working test with a DefaultParameterTransformer (using Jackson). When I run this test in IntelliJ it succeeds. Although when running with Surefire, the test fails.
Output with Intellij:
Output with Surefire:
To Reproduce
Steps to reproduce the behavior:
mvn verify
Expected behavior
The feature should succeed both in Surefire as in IntelliJ.
Your Environment
The text was updated successfully, but these errors were encountered: