Skip to content

#1869: Improve windows helper to search windows registry#1876

Open
jakozian wants to merge 6 commits intodevonfw:mainfrom
jakozian:feature/#1869-improve-windows-helper-to-search-windows-registry
Open

#1869: Improve windows helper to search windows registry#1876
jakozian wants to merge 6 commits intodevonfw:mainfrom
jakozian:feature/#1869-improve-windows-helper-to-search-windows-registry

Conversation

@jakozian
Copy link
Copy Markdown
Contributor

@jakozian jakozian commented Apr 29, 2026

This PR fixes #1869

Implemented changes:

  • Add methods to search for DisplayVersion, DisplayIcon, InstallLocation and UninstallString in common registry paths for an application.
  • Add tests

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled
    with internal

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Apr 29, 2026
@jakozian jakozian self-assigned this Apr 29, 2026
@jakozian jakozian added internal Nothing to be added to CHANGELOG, only internal story windows specific for Microsoft Windows OS labels Apr 29, 2026
@jakozian jakozian moved this from 🆕 New to 🏗 In progress in IDEasy board Apr 29, 2026
@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 25105221975

Coverage decreased (-0.04%) to 70.633%

Details

  • Coverage decreased (-0.04%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 19 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

19 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/os/WindowsHelperImpl.java 17 56.1%
com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java 1 78.33%
com/devonfw/tools/ide/version/VersionSegment.java 1 90.55%

Coverage Stats

Coverage Status
Relevant Lines: 15353
Covered Lines: 11302
Line Coverage: 73.61%
Relevant Branches: 6852
Covered Branches: 4382
Branch Coverage: 63.95%
Branches in Coverage %: Yes
Coverage Strength: 3.12 hits per line

💛 - Coveralls

@hohwille hohwille moved this from 🏗 In progress to Team Review in IDEasy board Apr 30, 2026
Copy link
Copy Markdown
Contributor

@MarvMa MarvMa left a comment

Choose a reason for hiding this comment

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

Thats a really easy to read PR following the KISS principle, which I personally appreciate a lot 👍 I left some comments regarding minor changes. I have been more critical since that has been the desired task. But the coments are just related to minor changes in code-style regarding the coding-conventions of IDEasy.


/**
* @param appName the application name to search for in the Windows registry.
* @return the DisplayName entry if the application is found in the Windows registry or {@code null} if nothing was found.
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.

Nice addition of the lookup methods! The JavaDoc could be enriched with some more information regarding the search itself e.g. which paths are beeing searched and whether the matching is case insensitive, exact or substring match.


for (String registryBasePath : REGISTRY_BASE_PATHS) {
List<String> out = runReg("query", registryBasePath, "/s", "/f", appName);
if (out != null) {
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.

Here it could be worth considering adding a check for an empty list. the runReg() method in the test returns List.of() for a miss, while the actual implementation returns null. Updating the return for a miss in the test-method or add an empty list check here could solve these different "miss" values.

Suggested change
if (out != null) {
if (out != null && !out.isEmpty()) {

}

@Override
protected List<String> runReg(String... args) {
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.

Overwriting the runReg in the Test is a clean style. One thing I found is that the simulation logic appears to be identical in WindowsHelperMock. To reduce redundancy the WindowsHelper could delegate to the WindowsHelperImplTestable method.

}

// Only return output if searched app matches
if (!"TestApp".equalsIgnoreCase(searchValue)) {
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.

You could reuse the already existing MOCK_APP_NAME constant here.

Suggested change
if (!"TestApp".equalsIgnoreCase(searchValue)) {
if (!MOCK_APP_NAME .equalsIgnoreCase(searchValue)) {

* Tests if correct keys can be found in registry output for app name filter.
*/
@Test
void testRegistryLookupReturnsCorrectEntryIfFound() {
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.

Really nice structured test which is easy to understand and the current grouping approach is perfectly readable.
Anyways maybe it is worth considering splitting this test in three separate Tests, in case of a failure the test name clarifies which registry search doesn't work immediatly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Nothing to be added to CHANGELOG, only internal story windows specific for Microsoft Windows OS

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Improve WindowsHelper to search in windows registry

4 participants