Repository navigation
Move tests to their recipe's package and name them after it (K10 of #1330) - #1358
Merged
Merged
Conversation
`AddTableGeneratorTest` and `MigrateJaxwsMavenPluginTest` move to `javax`, `ApacheDefaultProviderTest` and `ServletIsRequestedSessionIdFromURLTest` to `javaee8`, `OpenJPAPersistenceProviderTest` to `javaee7`, and `MigrateZipErrorToZipExceptionTest` to the root package.
Rename tests whose class name pointed at a different recipe, and retarget `UpgradeSpringBootParentForJava25Test` and `AddJakartaXmlBindRuntimeTest` at the recipe they mostly exercise, keeping the end-to-end cases on the composite. Split the Log4j2, JUL, JBoss and Commons Logging cases out of `UseSlf4jTest` into one test class per recipe, and fold the `NoGuava` integration tests for `Predicates.equalTo` and `Sets.filter` into `NoGuavaTest`: their sub-recipes on their own produce different output.
Replace `Environment.builder().scanRuntimeClasspath(..)` in `UseVarKeywordTest`, `JavaLangAPIsTest` and `PreferJavaUtilOptionalTest`. `PreferJavaUtilOptionalTest` now runs `PreferJavaUtilOptional` rather than all of `NoGuava`; the one case that also relies on the `Supplier` type change adds `PreferJavaUtilSupplier`. Drop the second `@DocumentExample`, which sat on an `@ExpectedToFail` test.
22 of 72 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses K10 of #1330. Several tests sat in a different package from their recipe, or were named after a recipe other than the one they run. That makes them hard to find from the recipe, and in a few cases hid that the named sub-recipe wasn't tested on its own. Only test sources change.
Moves (
git mv, so history follows; package declarations updated, andAddTableGeneratorTestno longer needs its import):javaee/AddTableGeneratorTestandmaven/MigrateJaxwsMavenPluginTestgo tojavaxjavaee/ApacheDefaultProviderTestandServletIsRequestedSessionIdFromURLTestgo tojavaee8javaee/OpenJPAPersistenceProviderTestgoes tojavaee7lang/MigrateZipErrorToZipExceptionTestgoes to the root packageHttpSessionInvalidateTestwas already injavaxon main, so I skipped it.Renames and retargets. Where the named recipe exists, I checked whether the test could run it directly with the same expected output:
NoGuavaPredicatesEqualToTestandNoGuavaSetsFilterTestare folded intoNoGuavaTest, since both runNoGuavaand these really are integration tests. I tried runningNoGuavaPredicatesEqualToandNoGuavaSetsFilterdirectly and 5 of 6 tests fail. Both rely onPreferJavaUtilPredicateto swap thePredicateimport, and theequalTocases also needNoGuavaPredicatesAndOr. Run alone,NoGuavaPredicatesEqualToreturns ajava.util.function.Predicatewhere a GuavaPredicateis declared, which doesn't compile; that may be worth a separate look. The two moved@DocumentExamples are dropped, soNoGuavaTestkeeps one.JakartaXmlBindRuntimeTestbecomesAddJakartaXmlBindRuntimeTest, withAddJakartaXmlBindRuntimeas the default recipe (8 of its 11 tests already overrode to it). The three end-to-end cases, including the document example, still runJavaxXmlBindMigrationToJakartaXmlBindexplicitly.UpdateAnnotationAttributeJavaxToJakartaTestbecomesJakartaEE10AnnotationAttributesTest. I didn't retarget it: thejavaxtojakartapackage change comes fromJakartaEE10, andUpdateAnnotationAttributeJavaxToJakartaonly rewrites literals on annotations that are alreadyjakarta, so every expected output would change.UpgradeSpringBootForJava25TestbecomesUpgradeSpringBootParentForJava25Testand now runsUpgradeSpringBootParentForJava25instead ofUpgradePluginsForJava25. Outputs are unchanged, and the document example still checks thatUpgradeToJava25includes it.MigrateJaxwsMavenPluginTestbecomesMigrateJaxBWSPluginTest, after thejavax.MigrateJaxBWSPluginrecipe it runs.MigrateInflaterDeflaterToAutoCloseableTestbecomesMigrateInflaterDeflaterToCloseTest,UseThreadsOrExecutorsTestbecomesFindVirtualThreadOpportunitiesTest, andUseVarForObjectsTestbecomesUseVarForObjectTest. These are renames only.ConvertToLogAnnotationTestbecomesUseSlf4jTest. Its single Log4j2, JUL, JBoss and Commons Logging cases move intoUseLog4j2Test,UseLogTest,UseJBossLogTestandUseCommonsLogTest, one per recipe, each with its own document example.ConvertAnyLogTestbecomesUseLombokLogAnnotationsTest. It wasn't on the list, but it had the same problem.recipeFromResources:UseVarKeywordTest,JavaLangAPIsTestandPreferJavaUtilOptionalTestno longer useEnvironment.builder().scanRuntimeClasspath(..).PreferJavaUtilOptionalTestalso moves from all ofNoGuavatoPreferJavaUtilOptional; the one case that needs theSuppliertype change addsPreferJavaUtilSupplier. Its second@DocumentExamplesat on an@ExpectedToFailtest, which is whyexamples.ymlcurrently shows a wrong "after", so I dropped it.For reviewers:
UseVarForObjectsTestandUseVarKeywordTestare also being edited in K11. Here they only get the rename and the loading change, so git's rename detection should keep a rebase simple.examples.ymlstill names the old test classes. I left it alone because the best-practices automation regenerates it.UseVarKeywordTestrunsUseVar, so it's misnamed too. I left the name alone to avoid colliding with K11.Verification:
./gradlew testfor every moved, renamed, split or reloaded class (all oflombok.log,javaee7,javaee8,NoGuavaTest,AddJakartaXmlBindRuntimeTest,JakartaEE10AnnotationAttributesTest,UpgradeSpringBootParentForJava25Test,MigrateInflaterDeflaterToCloseTest,FindVirtualThreadOpportunitiesTest,UseVarForObjectTest,AddTableGeneratorTest,MigrateJaxBWSPluginTest,MigrateZipErrorToZipExceptionTest,UseVarKeywordTest,JavaLangAPIsTest,PreferJavaUtilOptionalTest). 165 tests ran with 0 failures; the 6 skipped are existing@Disabled/@ExpectedToFailtests.