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

Support Refaster#anyOf() #76

Merged
merged 13 commits into from
Mar 7, 2024
Merged

Support Refaster#anyOf() #76

merged 13 commits into from
Mar 7, 2024

Conversation

knutwannheden
Copy link
Contributor

For @BeforeTemplate annotated methods which contain one Refaster#anyOf() call we can support that by generating a corresponding number of JavaTemplates.

For `@BeforeTemplate` annotated methods which contain one `Refaster#anyOf()` call we can support that by generating a corresponding number of `JavaTemplate`s.
@knutwannheden knutwannheden marked this pull request as draft March 6, 2024 09:22
@knutwannheden
Copy link
Contributor Author

So far just added a test.

@knutwannheden knutwannheden marked this pull request as ready for review March 7, 2024 11:04
@timtebeek
Copy link
Contributor

Noticed a small potential issue on the generated methods for Error Prone Support. For AssertJBooleanRules we now generate AssertJBooleanRulesRecipes, which includes

AbstractBooleanAssertIsNotEqualToRecipe

                final JavaTemplate before = JavaTemplate
                        .builder("#{boolAssert:any(org.assertj.core.api.AbstractBooleanAssert<?>)}.isEqualTo(!#{other:any(boolean)})")
                        .javaParser(JavaParser.fromJavaVersion().classpath("assertj-core"))
                        .build();

AbstractBooleanAssertIsTrueRecipe

                final JavaTemplate before$0 = JavaTemplate
                        .builder("boolAssert.isEqualTo(true)")
                        .javaParser(JavaParser.fromJavaVersion().classpath("assertj-core"))
                        .build();

Notice how the second form does not include any type with the matcher before templates. In the after methods those types are present.

Now that we skip the intermediate step with lambdas, there is no need to generate imports for any types from the template code.
@knutwannheden knutwannheden merged commit 7b766b8 into main Mar 7, 2024
1 check passed
@knutwannheden knutwannheden deleted the anyof branch March 7, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants