Skip to content

Commit

Permalink
Unit test the JavaVersion.RUNTIME_VERSION.
Browse files Browse the repository at this point in the history
  • Loading branch information
baron1405 committed Jun 28, 2024
1 parent 6f58c06 commit 56e7061
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/java/org/cthing/versionparser/java/JavaVersionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,19 @@ public void testOrdering(final String version1, final Order order, final String
default -> throw new IllegalStateException("Unexpected value: " + order);
}
}

@Test
public void testRuntimeVersion() {
final Runtime.Version expectedVersion = Runtime.version();
final JavaVersion actualVersion = JavaVersion.RUNTIME_VERSION;

assertThat(actualVersion.getFeature()).isEqualTo(expectedVersion.feature());
assertThat(actualVersion.getInterim()).isEqualTo(expectedVersion.interim());
assertThat(actualVersion.getUpdate()).isEqualTo(expectedVersion.update());
assertThat(actualVersion.getPatch()).isEqualTo(expectedVersion.patch());
assertThat(actualVersion.getBuild()).isEqualTo(expectedVersion.build());
assertThat(actualVersion.getPre()).isEqualTo(expectedVersion.pre());
assertThat(actualVersion.getOptional()).isEqualTo(expectedVersion.optional());
assertThat(actualVersion.getComponents()).isEqualTo(expectedVersion.version());
}
}

0 comments on commit 56e7061

Please sign in to comment.