Skip to content

Extract inline Mockito mock creations#5823

Merged
mostafa-mohammed-sonarsource merged 1 commit into
masterfrom
mm/fix-mock-creation
Jul 20, 2026
Merged

Extract inline Mockito mock creations#5823
mostafa-mohammed-sonarsource merged 1 commit into
masterfrom
mm/fix-mock-creation

Conversation

@mostafa-mohammed-sonarsource

@mostafa-mohammed-sonarsource mostafa-mohammed-sonarsource commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extract Mockito mocks passed inline to thenReturn into named local variables
  • resolve the five java:S9016 issues failing the SonarQube Next quality gate
  • preserve the existing test behavior

Testing

CI will verify the affected test suites and SonarQube quality gate.

Extract mocks passed directly to thenReturn into named local variables across the affected tests. This satisfies S9016 and preserves the existing stubbing behavior while allowing Mockito to validate unfinished stubbing correctly.

These five findings were the only open issues causing the SonarQube Next quality gate to fail.
@mostafa-mohammed-sonarsource mostafa-mohammed-sonarsource changed the title SONARJAVA-6604 Extract inline Mockito mock creations Extract inline Mockito mock creations Jul 20, 2026
@gitar-bot

gitar-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Extracts inline Mockito mock creations into named local variables to resolve five java:S9016 violations. Existing test behavior is preserved, and no further issues were identified.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@mostafa-mohammed-sonarsource
mostafa-mohammed-sonarsource marked this pull request as ready for review July 20, 2026 11:57

@mallory-scotton mallory-scotton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@sonarqube-next

Copy link
Copy Markdown

@mostafa-mohammed-sonarsource
mostafa-mohammed-sonarsource merged commit 301974e into master Jul 20, 2026
18 checks passed
@mostafa-mohammed-sonarsource
mostafa-mohammed-sonarsource deleted the mm/fix-mock-creation branch July 20, 2026 12:18
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.

2 participants