Skip to content

parameterize ProductAdaptersContractTest with @ParameterizedTest#4

Merged
vzakharchenko merged 1 commit into
mainfrom
refactor/parameterize-product-adapter-contract-test
May 17, 2026
Merged

parameterize ProductAdaptersContractTest with @ParameterizedTest#4
vzakharchenko merged 1 commit into
mainfrom
refactor/parameterize-product-adapter-contract-test

Conversation

@vzakharchenko
Copy link
Copy Markdown
Member

Three nested classes (Jira/Confluence/Other) each ran the same five contract assertions against a different stub adapter. JUnit 5 was designed for this shape: one set of parameterized methods driven by a MethodSource that yields the three stubs collapses 15 test methods into 5 and removes the qlty:similar-code finding without weakening the contract.

The "{0}" display name and "adapters" source name are extracted into constants so PMD's AvoidDuplicateLiterals stays quiet, and the source method is annotated with @SuppressWarnings("UnusedMethod") because Error Prone cannot see the string-based reflection link.

StubProductAdapterBase now declares abstract authenticatedAsAddon / authenticatedAsCurrentUser / impersonation so the parameterized test can call through the common base type while each concrete stub still satisfies its specific *ProductAdapter interface.

Three nested classes (Jira/Confluence/Other) each ran the same five contract
assertions against a different stub adapter. JUnit 5 was designed for this
shape: one set of parameterized methods driven by a MethodSource that yields
the three stubs collapses 15 test methods into 5 and removes the
qlty:similar-code finding without weakening the contract.

The "{0}" display name and "adapters" source name are extracted into
constants so PMD's AvoidDuplicateLiterals stays quiet, and the source method
is annotated with @SuppressWarnings("UnusedMethod") because Error Prone
cannot see the string-based reflection link.

StubProductAdapterBase now declares abstract authenticatedAsAddon /
authenticatedAsCurrentUser / impersonation so the parameterized test can call
through the common base type while each concrete stub still satisfies its
specific *ProductAdapter interface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@qltysh
Copy link
Copy Markdown

qltysh Bot commented May 17, 2026

Qlty


Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@vzakharchenko vzakharchenko merged commit 5ec1b5c into main May 17, 2026
7 checks passed
@vzakharchenko vzakharchenko deleted the refactor/parameterize-product-adapter-contract-test branch May 17, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant