-
Notifications
You must be signed in to change notification settings - Fork 81
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
Convert Cucumber-Java8 Steps & Hooks to Cucumber-Java #262
Conversation
...in/java/org/openrewrite/java/testing/cucumber/CucumberJava8StepDefinitionToCucumberJava.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/testing/cucumber/CucumberJava8ClassVisitor.java
Outdated
Show resolved
Hide resolved
import static org.openrewrite.java.Assertions.version; | ||
|
||
@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/259") | ||
class CucumberJava8ToCucumberJavaTest implements RewriteTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figured create a Java test already, as I heard the Kotlin tests might be going away.
} | ||
|
||
private String formatMethodArguments() { | ||
// TODO Type loss here, but my attempts to pass these as J failed: __P__.<java.lang.Object>/*__p0__*/p <error>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imports are not an issue in practice, as templates will use the original imports,
but any comments attached to lambda arguments (unlikely) are lost.
private String formatMethodArguments() { | ||
J firstLambdaParameter = lambda.getParameters().getParameters().get(0); | ||
if (firstLambdaParameter instanceof J.VariableDeclarations) { | ||
return String.format("io.cucumber.java.Scenario %s", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully qualified class name to work around not yet knowing how else to insert the correct type.
Could be either properly fixed here, or through a doAfterVisit
to go from FQCN use to import.
CI shows a test failure with TestsShouldNotBePublicTest; that's unrelated and has happened a few times before.
|
Converts Steps & Hooks to Cucumber-Java. Fixes #259
There's a few questions marked in the code, as TODO comments;
Any feedback there appreciated, mostly to see if there's a better way.
Git history is quite messy; I suggest a squash if this were to make it in.
If not suitable here, might target cucumber-jvm repository directly.