#1731: Fixed Solar Install returning NPE#1734
Conversation
Pull Request Test Coverage Report for Build 22949388609Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR targets issue #1731 by adjusting SonarQube tool execution/installation behavior (path/binary resolution) and adding a dedicated test fixture plus JUnit tests for the Sonar commandlet.
Changes:
- Updated
Sonarcommandlet binary/path resolution (including an override to use an absolute executable path). - Added a new WireMock-based
SonarTestand a full sonar test project fixture undersrc/test/resources/ide-projects/sonar/. - Added a changelog entry for #1731.
Reviewed changes
Copilot reviewed 7 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/src/main/java/com/devonfw/tools/ide/tool/sonar/Sonar.java | Adjusts binary selection and configures the process executable using an absolute path. |
| cli/src/test/java/com/devonfw/tools/ide/sonar/SonarTest.java | Adds tests for parsing/initializing Sonar commands (START/STOP/ANALYZE). |
| cli/src/test/resources/ide-projects/sonar/repository/sonar/sonar/default/conf/sonar.properties | Adds minimal SonarQube config used by the fixture. |
| cli/src/test/resources/ide-projects/sonar/repository/sonar/sonar/default/bin/windows-x86-64/StartSonar.bat | Adds mocked Windows start script for tests. |
| cli/src/test/resources/ide-projects/sonar/repository/sonar/sonar/default/bin/windows-x86-64/SonarService.bat | Adds mocked Windows service script for tests. |
| cli/src/test/resources/ide-projects/sonar/repository/sonar/sonar/default/bin/linux-x86-64/sonar.sh | Adds mocked Linux script for tests. |
| cli/src/test/resources/ide-projects/sonar/repository/sonar/sonar/default/bin/macosx-universal-64/sonar.sh | Adds mocked macOS script for tests. |
| cli/src/test/resources/ide-projects/sonar/repository/sonar/sonar/default/.ide.software.version | Adds pinned sonar version file for the fixture. |
| cli/src/test/resources/ide-projects/sonar/project/settings/ide.properties | Adds SONAR_VERSION setting for fixture project. |
| cli/src/test/resources/ide-projects/sonar/_ide/urls/sonar/sonar/26.3.0.120487/urls | Adds mocked download URL for ToolRepositoryMock usage. |
| CHANGELOG.adoc | Adds release note entry for #1731. |
hohwille
left a comment
There was a problem hiding this comment.
@tmukh thanks for finding the bug, creating the issue, creating PR, fixing the NPE and especially adding the missing JUnit test. 👍This is really great work and surprised me since you just on-boarded to our team 🚀
I did my usual picky review and left you various constructive review comments.
Please note that if you auto-apply them (e.g. in batch) there will be some import statements missing in the SonarTest causing compile errors. You can still do that and pull the result, add the imports and commit + push, or do not accept the suggestions adding @ParameterizedTest and address them manually.
FYI: The SonarTest will still not run the run() method of the commandlet what is typically the most valuable thing to test. If you ever consider to add this in this PR or later after merge, please consider that *.bat files cannot be executed on OS other than windows. You could fake them by technically putting a bash script into such .bat file what is a little hack but could do the trick. Otherwise you would need to run that test method only for the current OS.
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
cli/src/test/java/com/devonfw/tools/ide/tool/sonar/SonarTest.java
Outdated
Show resolved
Hide resolved
|
Thanks for the comments @hohwille , I implemented the changes and hope that it's up to what you wanted. Side note: I ended up rebasing on my old local main branch, and had to figure out for 30 minutes hwo to undo a rebase.
|

This PR fixes #1731
Implemented changes:
Structure Created:
The tests follow the same pattern as the other tests, using the @wiremocktest annotation and AbstractIdeContextTest
base class for proper test isolation and context management.
Checklist for this PR
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.bat). If no issue ID exists, title only.In Progressand assigned to you or there is no issue (might happen for very small PRs)with
internal