Skip to content

[Misc] Use dedicated assertions instead of boolean assertions in tests (SonarCloud java:S5785)#5834

Open
vmassol wants to merge 1 commit into
masterfrom
claude/vigilant-dirac-xj1fsv
Open

[Misc] Use dedicated assertions instead of boolean assertions in tests (SonarCloud java:S5785)#5834
vmassol wants to merge 1 commit into
masterfrom
claude/vigilant-dirac-xj1fsv

Conversation

@vmassol

@vmassol vmassol commented Jul 13, 2026

Copy link
Copy Markdown
Member

Fixes 25 SonarCloud java:S5785 issues ("Use the assertions dedicated to the comparison, not assertTrue/assertFalse") across 11 test classes.

The boolean assertions are replaced with the assertion Sonar recommends for each site:

  • assertTrue(a.equals(b)) / assertFalse(a.equals(b))assertEquals(a, b) / assertNotEquals(a, b) (receiver kept first so the exact same equals call is reproduced)
  • assertTrue(x == y) / assertFalse(x == y) reference identity → assertSame / (assertNotSame)
  • assertTrue(LIT == x)assertEquals(LIT, x)
  • assertTrue(x != null)assertNotNull(x)

Static imports are adjusted accordingly (unused assertTrue/assertFalse removed, new ones added).

Behaviour-preserving; the affected test classes were run and pass.

SonarCloud rule: https://sonarcloud.io/organizations/xwiki/rules?open=java%3AS5785&rule_key=java%3AS5785


Generated by Claude Code

…s (SonarCloud java:S5785)

* Replace assertTrue/assertFalse on equals(), ==, != and null checks with
  assertEquals/assertNotEquals/assertSame/assertNotNull across 11 test classes.

Co-Authored-By: Vincent Massol <vincent@massol.net>
@vmassol vmassol added the llm-agent To be used for PRs created autonomously by LLM agents. label Jul 13, 2026 — with Claude
@vmassol vmassol self-assigned this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-agent To be used for PRs created autonomously by LLM agents.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant