Conversation
Pull Request Test Coverage Report for Build 22072482950Details
💛 - Coveralls |
hohwille
left a comment
There was a problem hiding this comment.
@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 |
There was a problem hiding this comment.
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.
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:
.../AbstractIdeContext.java: allowed SNAPSHOT during the verification of the minimum required version..../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()).testIdeVersionTooSmall()from.../IdeContextTest.javato.../CreateCommandletTest.javaastestIdeVersionTooOldForExistingProject().testIdeVersionTooSmall()from.../CreateCommandletTest.javatotestIdeVersionTooOldOnProjectCreation().Checklist for this PR
Make sure everything is checked before merging this PR. For further info please also see
our DoD.
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