Skip to content

Align test names with recipes, group no-change tests and tidy classpath entries and YAML - #1235

Merged
timtebeek merged 1 commit into
mainfrom
tim/test-naming-and-yaml-hygiene
Oct 25, 2026
Merged

timtebeek merged 1 commit into
mainfrom
tim/test-naming-and-yaml-hygiene

Conversation

@timtebeek

Copy link
Copy Markdown
Member

A handful of tests were named after something other than what they test, some parsers used unversioned or unneeded classpath entries, and a few YAML files had cosmetic leftovers. None of this changes recipe behaviour; it makes the tests easier to find and the sources more consistent.

Test naming

  • MockitoRuleDependencyTest is renamed to AddMockitoJupiterForRulesTest (via git mv), after the recipe it covers.
  • MockitoBestPracticesTest loaded Mockito1to5Migration, which already has its own Mockito1to5MigrationTest. It now loads MockitoBestPractices, which includes Mockito1to5Migration, so the existing expectations still hold and the test now covers the recipe it is named after.
  • AssertEqualsBooleanToAssertBooleanTest dropped a per-test spec.recipe(..) that repeated defaults().

No-change tests grouped in @Nested class NoChange, following HandleExternalResourceRulesTest. Tests were moved as-is, with names kept. This applies to classes with three or more no-change tests: AddTestcontainersAnnotationsTest, MigrateStubMappingUuidToIdTest, RemoveDuplicateContentTypeHeaderTest, RemoveDuplicateContentTypeStubHeaderTest, ReplaceRemovedConstructorsTest, ReplaceSettersWithTransformTest and Wiremock3to4MigrationTest.

Classpath entries

  • The nine TestNG tests now use classpathFromResources(ctx, "testng-7") instead of the runtime classpath("testng"). AddJupiterDependenciesTest now uses junit-jupiter-api-5.
  • Removed hamcrest-3 from the template parsers in TimeoutRuleToClassAnnotation and JUnitParamsRunnerToParameterized, and junit-4 from the one in AssertTrueInstanceofToAssertInstanceOf. None of those templates reference Hamcrest or JUnit 4 types.

YAML hygiene

  • Removed matchOverrides: false from the ChangeMethodName in junit6.yml; false is already the default for that option.
  • Removed the trailing --- from dbrider.yml.
  • Removed the stray blank lines and the 8-space indent in assertj.yml.

Skipped

  • No-change grouping was not applied to classes with only two no-change tests, where a nested class adds little: the DBRider ExecutionListenerToDbRiderAnnotationUnitTest (both already at the end), ReplaceContainerImageNameTest, MigrateContentTypeHeaderCharsetTest, MigrateRequestMethodIsOneOfTest and WireMockRuleToWireMockServerTest. The Arquillian tests currently have no no-change tests at all.
  • recipes.csv is not affected, as no names, descriptions or options changed.

Verified with ./gradlew test on the touched test classes and packages (the assertj, testng, testcontainers, wiremock, dbrider and junit6 packages, plus AddMockitoJupiterForRulesTest, MockitoBestPracticesTest, AssertEqualsBooleanToAssertBooleanTest, AddJupiterDependenciesTest, TimeoutRuleToClassAnnotationTest, JUnitParamsRunnerToParameterizedTest, AssertTrueInstanceofToAssertInstanceOfTest and JUnit5MigrationTest): 846 tests, 0 failures.

Fixes item N10 of #1211.

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Oct 25, 2026
@timtebeek
timtebeek merged commit 20ea9e3 into main Oct 25, 2026
2 checks passed
@timtebeek
timtebeek deleted the tim/test-naming-and-yaml-hygiene branch October 25, 2026 13:35
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Oct 25, 2026
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.

1 participant