Skip to content

#1703 allow snapshot usage#1705

Open
SDallmann wants to merge 8 commits intodevonfw:mainfrom
SDallmann:#1703-allow-snapshot-usage
Open

#1703 allow snapshot usage#1705
SDallmann wants to merge 8 commits intodevonfw:mainfrom
SDallmann:#1703-allow-snapshot-usage

Conversation

@SDallmann
Copy link
Contributor

@SDallmann SDallmann commented Feb 6, 2026

This PR fixes #1703

In order to be able create projects while using the SNAPSHOT version, said version was permitted during the verification of the minimum required version. This change affected some Unit Tests, which had to be adapted.

Implemented changes:

  1. In .../AbstractIdeContext.java: allowed SNAPSHOT during the verification of the minimum required version.
  2. In .../IdeVersion.java: added a method to mock the current version from SNAPSHOT to a specific version (setMockVersionForTesting(..)) and a method to reset the version back to SNAPSHOT (setSnapshotVersionForTesting()).
  3. Moved and renamed the test testIdeVersionTooSmall() from .../IdeContextTest.java to .../CreateCommandletTest.java as testIdeVersionTooOldForExistingProject().
  4. Renamed the test testIdeVersionTooSmall() from .../CreateCommandletTest.java to testIdeVersionTooOldOnProjectCreation().
  5. Adapted both tests from 3. and 4. to use the methods added in 2.

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

@coveralls
Copy link
Collaborator

coveralls commented Feb 6, 2026

Pull Request Test Coverage Report for Build 22072482950

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 16 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.006%) to 70.471%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/context/AbstractIdeContext.java 16 67.19%
Totals Coverage Status
Change from base Build 22072399074: 0.006%
Covered Lines: 10498
Relevant Lines: 14311

💛 - Coveralls

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@SDallmann thanks for your PR. All looking good to me. 👍
I added a single review comment for improvement of the JUnit.
Apart from that ready for merge.

variables.getByType(EnvironmentVariablesType.CONF).set("IDE_MIN_VERSION", ideMinVersion);
// assert
assertThatThrownBy(() -> cc.run()).hasMessage(errorMessage);
IdeVersion.setSnapshotVersionForTesting(); // reset current version back to SNAPSHOT so further tests don't fail
Copy link
Member

Choose a reason for hiding this comment

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

Great finding.
However, the best way to do this is in an @AfterAll method that is guaranteed to be executed by JUnit after this method (and allows to do it in a single place so you do not have to repeat it in testIdeVersionTooOldForExistingProject()).
Assume that some assertion above fails then this line is never reached.
You could avoid this by a try {} finally {} block but the easiest and cleanest solution is to use @AfterAll for cleaning up such side-effects. The method should be called tearDown() according to JUnit conventions.

@github-project-automation github-project-automation bot moved this from 🆕 New to 👀 In review in IDEasy board Feb 16, 2026
@hohwille hohwille added internal Nothing to be added to CHANGELOG, only internal story update related to updating software or the entire ide create Create commandlet used to create new IDEasy projects with "ide create" labels Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create Create commandlet used to create new IDEasy projects with "ide create" internal Nothing to be added to CHANGELOG, only internal story update related to updating software or the entire ide

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

Allow usage of SNAPSHOT-version to create new projects

3 participants

Comments