Skip to content

Issue 6459 otel assertions no extends - #8788

Open
Rajkaran-122 wants to merge 1 commit into
open-telemetry:mainfrom
Rajkaran-122:issue-6459-otel-assertions-no-extends
Open

Issue 6459 otel assertions no extends#8788
Rajkaran-122 wants to merge 1 commit into
open-telemetry:mainfrom
Rajkaran-122:issue-6459-otel-assertions-no-extends

Conversation

@Rajkaran-122

Copy link
Copy Markdown
Contributor

Description

Fixes #6459

This PR documents the existing workaround for the ambiguity caused when OpenTelemetryAssertions is statically imported alongside other assertion libraries such as Truth.

OpenTelemetryAssertions currently extends AssertJ's Assertions, which can introduce an ambiguous assertThat(...) reference when multiple assertion libraries are used together.

Changes

  • Added Javadoc to OpenTelemetryAssertions explaining the assertion ambiguity.

  • Documented the recommended workaround:

    • Avoid a static import of OpenTelemetryAssertions.
    • Reference OpenTelemetryAssertions.assertThat(...) explicitly.
  • Added a test demonstrating that the non-static import workaround works as expected.

Compatibility

This approach intentionally avoids removing extends Assertions, which would be an API-breaking change for existing users.

The change therefore provides documentation and an example of the existing non-breaking workaround without modifying the public API.

Validation

  • TraceAssertionsTest passes.
  • Spotless formatting checks pass.
  • Changes are isolated to the #6459 work.

Related

Fixes #6459

@Rajkaran-122
Rajkaran-122 requested a review from a team as a code owner September 9, 2026 20:02
…pen-telemetry#6459)

Add Javadoc documentation explaining that OpenTelemetryAssertions extends
AssertJ's Assertions class, which brings in generic assertThat(T) and causes
ambiguity when using static imports alongside other assertion libraries like
Truth. Document the workaround: use non-static import and reference methods
explicitly via OpenTelemetryAssertions.assertThat(...).

Add test demonstrating the workaround to ensure it compiles and works correctly.
@Rajkaran-122
Rajkaran-122 force-pushed the issue-6459-otel-assertions-no-extends branch from 3ef7b7a to bd18504 Compare September 9, 2026 20:04
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.30%. Comparing base (f8bd413) to head (bd18504).
⚠️ Report is 72 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8788      +/-   ##
============================================
- Coverage     91.48%   91.30%   -0.19%     
- Complexity    10467    10518      +51     
============================================
  Files          1021     1007      -14     
  Lines         27694    28386     +692     
  Branches       3247     3591     +344     
============================================
+ Hits          25337    25917     +580     
- Misses         1615     1675      +60     
- Partials        742      794      +52     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rajkaran-122

Rajkaran-122 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@jkwatson @jack-berg sir PTAL #8788 .

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.

Avoid extending assertj Assertions in OpenTelemetryAssertions

1 participant