ReleaseUtil { public static String getReleaseVersion(String version, Optional<String> defaultReleaseVersion, Optional<Prompter> prompter) { if (defaultReleaseVersion.isPresent()) { return defaultReleaseVersion.get(); } String releaseVersion = MavenVersionUtil.calculateReleaseVersion(version); if (prompter.isPresent()) { try { releaseVersion = prompter.get().prompt("Please specify the release version", releaseVersion); } catch (PrompterException e) { } } return releaseVersion; }  static String getReleaseVersion(String version, Optional<String> defaultReleaseVersion,
      Optional<Prompter> prompter); static String getNextDevelopmentVersion(String version, Optional<String> defaultDevelopmentVersion,
      Optional<Prompter> prompter, VersionUpgradeStrategy upgradeStrategy); static String getTagName(String pattern, MavenProject project, PluginParameterExpressionEvaluator evaluator); static boolean isIntegrationtest(); static File getMavenHome(Optional<String> userDefined);  }
@Test @DataProvider({ "1-SNAPSHOT,null,1", "1.0.0-SNAPSHOT,null,1.0.0", "3.1,null,3.1", "3.Alpha1-SNAPSHOT,null,3.Alpha1", "2.4,3,3", "2.1-SNAPSHOT,3,3" }) public void testGetReleaseVersion(String version, String defaultReleaseVersion, String expected) { Assert.assertEquals(expected, ReleaseUtil.getReleaseVersion(version, Optional.fromNullable(defaultReleaseVersion), Optional.<Prompter> absent())); }
@Test @DataProvider({ "1-SNAPSHOT,null,4,4", "2-SNAPSHOT,8,4,8" }) public void testGetReleaseVersion_Prompter(String version, String defaultReleaseVersion, String userInput, String expected) throws Exception { Prompter prompter = Mockito.mock(Prompter.class); Mockito.when(prompter.prompt((String) Matchers.notNull(), (String) Matchers.notNull())).thenReturn(userInput); Assert.assertEquals(expected, ReleaseUtil.getReleaseVersion(version, Optional.fromNullable(defaultReleaseVersion), Optional.of(prompter))); }