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

Convert Cucumber-Java8 Steps & Hooks to Cucumber-Java #262

Merged
merged 54 commits into from
Sep 30, 2022
Merged

Convert Cucumber-Java8 Steps & Hooks to Cucumber-Java #262

merged 54 commits into from
Sep 30, 2022

Conversation

timtebeek
Copy link
Contributor

@timtebeek timtebeek commented Sep 26, 2022

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.

@timtebeek timtebeek changed the title Draft: Convert Cucumber-Java8 to Cucumber-Java Convert Cucumber-Java8 Steps & Hooks to Cucumber-Java Sep 27, 2022
import static org.openrewrite.java.Assertions.version;

@Issue("https://github.com/openrewrite/rewrite-testing-frameworks/issues/259")
class CucumberJava8ToCucumberJavaTest implements RewriteTest {
Copy link
Contributor Author

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>()
Copy link
Contributor Author

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",
Copy link
Contributor Author

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.

@timtebeek
Copy link
Contributor Author

timtebeek commented Sep 30, 2022

CI shows a test failure with TestsShouldNotBePublicTest; that's unrelated and has happened a few times before.

TestsShouldNotBePublicTest > removeProtectedMethodModifiers() FAILED
    java.lang.IllegalStateException: AST contains missing or invalid type information
    MethodDeclaration->Block->ClassDeclaration->CompilationUnit

@jkschneider jkschneider merged commit e02bb26 into openrewrite:main Sep 30, 2022
@timtebeek timtebeek deleted the cucumber-java8 branch September 30, 2022 18:44
@tkvangorder tkvangorder added the recipe Recipe request label Oct 11, 2022
@tkvangorder tkvangorder added this to the 1.29.0 milestone Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Recipe request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Migrate from cucumber-java8 to cucumber-java
3 participants