MavenVersionUtil { public static String calculateNextSnapshotVersion(String version, VersionUpgradeStrategy upgradeStrategy) { VersionUpgradeStrategy strategy = upgradeStrategy != null ? upgradeStrategy : VersionUpgradeStrategy.DEFAULT; Version v = Version.parse(version); v.increase(strategy); String snapshotVersion = v.toString(); if (!snapshotVersion.endsWith(VERSION_QUALIFIER_SNAPSHOT)) { snapshotVersion += VERSION_QUALIFIER_SNAPSHOT; } return snapshotVersion; } private  MavenVersionUtil(); static boolean isSnapshot(String version); static String calculateNextSnapshotVersion(String version, VersionUpgradeStrategy upgradeStrategy); static String calculateNextSnapshotVersion(String version); static String calculateReleaseVersion(String version); static boolean isNewerVersion(String version1, String version2); static final String VERSION_QUALIFIER_SNAPSHOT; static final String VERSION_LATEST; }
@Test @UseDataProvider("calculateNextSnapshotVersion") public void testCalculateNextSnapshotVersion(String version, String expectedSnapshotVersion) { Assert.assertEquals(expectedSnapshotVersion, MavenVersionUtil.calculateNextSnapshotVersion(version)); }
@Test @UseDataProvider("calculateNextSnapshotVersionWithStrategy") public void testCalculateNextSnapshotVersionWithStrategy(String version, VersionUpgradeStrategy strategy, String expectedSnapshotVersion) { Assert.assertEquals(expectedSnapshotVersion, MavenVersionUtil.calculateNextSnapshotVersion(version, strategy)); }