Skip to content

Add unit tests to improve SonarScan tests code covarage#1836

Open
stiv03 wants to merge 3 commits into
cloudfoundry:masterfrom
stiv03:tests/increase-coverage-targeted
Open

Add unit tests to improve SonarScan tests code covarage#1836
stiv03 wants to merge 3 commits into
cloudfoundry:masterfrom
stiv03:tests/increase-coverage-targeted

Conversation

@stiv03
Copy link
Copy Markdown
Contributor

@stiv03 stiv03 commented May 19, 2026

Copy link
Copy Markdown
Contributor

@Yavor16 Yavor16 left a comment

Choose a reason for hiding this comment

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

Automated code review by MTA Quality Agent — 1 finding(s).

public OperationLogStorageException(String message, Throwable cause) {
super(message, cause);
super(cause, message);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Severity: CRITICAL · Confidence: 97

The Throwable and String arguments to super() are swapped. Exception(Throwable cause, String message) is not a valid Throwable constructor signature — Java's Exception has Exception(String message, Throwable cause). This will cause a compile error (the call won't compile) or, if a matching constructor does exist on a parent, silently discard the message string and misplace the cause.

Evidence: super(cause, message);

Fix:

Suggested change
}
super(message, cause);

@Yavor16
Copy link
Copy Markdown
Contributor

Yavor16 commented Jun 1, 2026

MTA Quality Report — cloudfoundry/multiapps-controller PR #1836

Jira: LMCROSSITXSADEPLOY-3258
Backlog alignment: WARN

  • Implements Jira scope? partial — The PR adds unit tests across multiple modules to improve Sonar coverage, which aligns with an improvement ticket, but also modifies a production file (OperationLogStorageException.java) that introduces a bug unrelated to the test coverage goal.
  • Changes outside Jira scope? yes — The production file change (super(cause, message)) and the sonar-project.properties modifications go beyond adding unit tests, and the production change introduces a regression.

Code Review

1 finding(s): 1 posted inline · 0 general.

See the inline review on the PR diff for posted findings.


Security

No security vulnerabilities found. The PR consists almost entirely of new JUnit/Mockito unit test files (58 of 59 changed files). The one production file change (OperationLogStorageException.java) swaps constructor arguments — this is a bug, not a security issue. The sonar-project.properties modification adds exclusion rules but introduces no security concerns.


SonarCloud

No SonarCloud check run found for this PR. The available check runs are: CodeQL (success), Build and analyze (success, GitHub Actions), Analyze (java) (success, GitHub Actions), build (failure), and Check Commit Message (failure). None of these are a SonarCloud quality gate check run.

Note — CI failures: Two checks failed:

  • Check Commit Message ❌ — The commit message does not contain the word LMCROSSITXSADEPLOY. The annotation states: "At least one commit must contain the word 'LMCROSSITXSADEPLOY'."
  • build ❌ — The Maven build failed (exit code 1). This is likely caused by the swapped constructor arguments in OperationLogStorageException.java which would produce a compile error.

Dependency CVEs

✅ No new CVEs — this PR does not modify any dependency files (pom.xml, build.gradle, lockfiles).

Comment thread sonar-project.properties Outdated
sonar.coverage.exclusions=\
multiapps-controller-core-test/**,\
multiapps-controller-persistence-test/**,\
multiapps-controller-database-migration/**,\
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove this from the exclusions

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