Skip to content

Use version patterns in ChangeDependencyGroupIdAndArtifactId tests#6856

Merged
Jenson3210 merged 1 commit intomainfrom
fix-swagger-version-test-assertions
Mar 3, 2026
Merged

Use version patterns in ChangeDependencyGroupIdAndArtifactId tests#6856
Jenson3210 merged 1 commit intomainfrom
fix-swagger-version-test-assertions

Conversation

@Jenson3210
Copy link
Copy Markdown
Contributor

Summary

  • Replace hardcoded version 2.2.43 with regex pattern assertions in 4 tests that resolve swagger-annotations to the latest 2.2.x version
  • Prevents test failures when new swagger-annotations versions are released (currently 2.2.44)

Problem

Four tests in ChangeDependencyGroupIdAndArtifactIdTest hardcode the expected resolved version 2.2.43 for io.swagger.core.v3:swagger-annotations when using the 2.2.x version pattern. When version 2.2.44 was released, all four tests started failing.

Solution

Use spec.after(actual -> assertThat(actual).containsPattern(...).actual()) — the same pattern already used elsewhere in this class — to match any 2.2.x resolved version instead of hardcoding a specific patch version.

Tests updated:

  • changeVersionPropertyInParentPomSimple
  • sharedPropertyInParentPomLeavesPropertyUnchangedAndInlinesVersion
  • sharedPropertyInParentPomUsedByDifferentChildrenLeavesPropertyUnchanged
  • childRedefinesPropertyUsedNonConflictinglyInlinesVersionInParent

Test plan

  • All 56 tests in ChangeDependencyGroupIdAndArtifactIdTest pass
  • No other changes required

Replace hardcoded version 2.2.43 with regex pattern assertions in 4
tests that resolve swagger-annotations to the latest 2.2.x version.
This prevents test failures when new swagger-annotations versions are
released.
Copy link
Copy Markdown
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the structural fix here.

@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Mar 3, 2026
@Jenson3210 Jenson3210 merged commit 0abe800 into main Mar 3, 2026
1 check passed
@Jenson3210 Jenson3210 deleted the fix-swagger-version-test-assertions branch March 3, 2026 11:24
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Mar 3, 2026
knutwannheden added a commit that referenced this pull request Apr 27, 2026
ChangeDependencyGroupIdAndArtifactIdTest.noDependencyManagementSection
hardcoded the post-recipe junit-jupiter version as 5.14.3, but the
recipe resolves "5.x" against Maven Central at runtime. Every new
junit-jupiter 5.x patch release breaks CI for every PR until someone
bumps the literal. The most recent break is 5.14.4, published earlier
today.

Switch the assertion to a regex pattern matching any 5.x.x release,
following the convention established in #6799 / #6856.
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