Versions { public static void checkIsIncrement(Version currentVersion, Version newVersion) { checkNotNull(currentVersion); checkNotNull(newVersion); if (!newVersion.isIncrement(currentVersion)) { String errMsg = format( "New version number (%d) cannot be less or equal to the current (%d).", newVersion.getNumber(), currentVersion.getNumber()); throw new IllegalArgumentException(errMsg); } } private  Versions(); static Version zero(); static Version newVersion(int number, Timestamp timestamp); static Version increment(Version version); static void checkIsIncrement(Version currentVersion, Version newVersion);  }
@Test @DisplayName("check Version increment") void checkVersionIncrement() { assertThrows(IllegalArgumentException.class, () -> Versions.checkIsIncrement( GivenVersion.withNumber(2), GivenVersion.withNumber(1) )); }