Skip to content

#2423: isRepositoryUpdateAvailable is not covered by any test that reaches the comparison - #2465

Open
JoelAdbu wants to merge 4 commits into
devonfw:mainfrom
JoelAdbu:feature/2423-isRepositoryUpdateAvailable-is-not-covered-by-any-test-that-reaches-the-comparison
Open

JoelAdbu wants to merge 4 commits into
devonfw:mainfrom
JoelAdbu:feature/2423-isRepositoryUpdateAvailable-is-not-covered-by-any-test-that-reaches-the-comparison

Conversation

@JoelAdbu

@JoelAdbu JoelAdbu commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2423

Implemented changes:

  • enhanced ProcessContextGitMock to support sequential Git outputs by adding a per-command FIFO (addCommandOutput), allowing multiple git invocations within a single test flow to return distinct results
  • updated testIsRepositoryUpdateAvailableNoUpdates to simulate a configured upstream and identical local/remote commit IDs, ensuring the actual commit comparison is reached
  • added testIsRepositoryUpdateAvailableUpdates to cover the case where local and remote commit IDs differ and an update is available
  • added additional edge case tests covering missing upstream configuration and null commit IDs
  • removed unused test data (errors / outs) and updated the Javadocs to accurately reflect the tested behavior

Testing instructions

Please add conscise, understandable instructions on how a reviewer can test/verify the functionality of your contribution here:

  1. Open GitContextTest
  2. Run the newly added tests with coverage.
  3. Verify all test pass successfully and verify that GitContextImpl.isRepositoryUpdateAvailable(Path) is covered by the test execution.

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 and not feature/921 fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summaries 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 labelled
    with internal
  • You have not changed any dependency in pom.xml files or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Sep 11, 2026
@JoelAdbu JoelAdbu added enhancement New feature or request test related to testing and QA git git version management tool integration internal Nothing to be added to CHANGELOG, only internal story labels Sep 11, 2026
@JoelAdbu
JoelAdbu marked this pull request as ready for review September 11, 2026 13:43
@JoelAdbu JoelAdbu moved this from 🆕 New to Team Review in IDEasy board Sep 11, 2026
@coveralls

coveralls commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 34966294534

Coverage increased (+0.1%) to 74.267%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 4 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

4 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/git/GitContextImpl.java 3 40.82%
com/devonfw/tools/ide/version/VersionSegment.java 1 91.34%

Coverage Stats

Coverage Status
Relevant Lines: 19001
Covered Lines: 14740
Line Coverage: 77.57%
Relevant Branches: 8516
Covered Branches: 5696
Branch Coverage: 66.89%
Branches in Coverage %: Yes
Coverage Strength: 3.31 hits per line

💛 - Coveralls

@quando632 quando632 self-assigned this Sep 11, 2026

@quando632 quando632 left a comment

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 catch on the root cause: the old testIsRepositoryUpdateAvailableNoUpdates built two Lists that never reached the mock, so the commit comparison was never executed. The sequential output queue fixes that, and both the no-update and the update path are now genuinely covered. One non-blocking note inline on the "commit id missing" tests.

Comment thread cli/src/test/java/com/devonfw/tools/ide/git/GitContextTest.java Outdated
- added queue to support sequential Git outputs in repository update tests
- added 4 new test for repository update available
- support exit codes and failures in git mock
@JoelAdbu
JoelAdbu force-pushed the feature/2423-isRepositoryUpdateAvailable-is-not-covered-by-any-test-that-reaches-the-comparison branch from 2e69fd2 to ec84184 Compare September 15, 2026 06:41

@quando632 quando632 left a comment

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 now everything looks good for me. You only need to update the branch with main, then we can move this to In-Review :)

…not-covered-by-any-test-that-reaches-the-comparison
@JoelAdbu JoelAdbu moved this from Team Review to 👀 In review in IDEasy board Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request git git version management tool integration internal Nothing to be added to CHANGELOG, only internal story test related to testing and QA

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

isRepositoryUpdateAvailable is not covered by any test that reaches the comparison

3 participants