On Fri, 21 Apr 2023 20:15:50 GMT, Christian Stein <cst...@openjdk.org> wrote:
>> Create an internal Version record to hold and compare versions of the form >> (major, minor, micro). >> Add `OperatingSystem.version()` to return the version of the running OS. >> Replace uses of os.version in java.base. >> Subsequent PRs will apply to uses in other modules including, jdk.jlink, >> jdk.jpackage, and java.desktop. > > test/jdk/jdk/internal/util/VersionTest.java line 64: > >> 62: Version actual = Version.parse(verName); >> 63: assertEquals(actual, expected, "Parsed version mismatch"); >> 64: } > > Another way to declare arguments is to use `CsvSource` like: > > > @ParameterizedTest > @CsvSource(textBlock = > """ > 1, 0, 0, 1 > 1, 2, 0, 1.2 > 1, 2, 0, 1.2.0 > 1, 2, 3, 1.2.3 > # Ignore extra trailing characters > 1, 0, 0, 1-abc > 1, 2, 0, 1.2-abc > 1, 2, 3, 1.2.3.4 > 1, 2, 3, 1.2.3-abc > """) > void checkParse(int major, int minor, int micro, Version actual) { > Version expected = new Version(major, minor, micro); > assertEquals(expected, actual, "Parsed version mismatch"); > } Good to know about CsvSource. The test is checking Version.parse(str) works. So I'd code it as: void checkParse(int major, int minor, int micro, String verString) { Version expected = new Version(major, minor, micro); Version actual = Version.parse(verString); assertEquals(expected, actual, "Parsed version mismatch"); } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13584#discussion_r1174136796