@Test public void canonicalVersionShouldOnlyContainVersionNumberWhenVersionIsRelease() { assertThat( VersionFormatter.asCanonicalVersion( "1.0", "201009291818", "1" ), equalTo( "1.0" ) ); }
public static String asCanonicalVersion( String version, String timestamp, String sequence ) { String derivedVersion = version; if ( derivedVersion == null ) { derivedVersion = VersionSupport.UNKNOWN; } String snapshot = "-SNAPSHOT"; if ( derivedVersion.contains( snapshot ) ) { derivedVersion = asRawVersion( version.replace( snapshot, "" ), timestamp, sequence ); } return derivedVersion; }
VersionFormatter { public static String asCanonicalVersion( String version, String timestamp, String sequence ) { String derivedVersion = version; if ( derivedVersion == null ) { derivedVersion = VersionSupport.UNKNOWN; } String snapshot = "-SNAPSHOT"; if ( derivedVersion.contains( snapshot ) ) { derivedVersion = asRawVersion( version.replace( snapshot, "" ), timestamp, sequence ); } return derivedVersion; } }
VersionFormatter { public static String asCanonicalVersion( String version, String timestamp, String sequence ) { String derivedVersion = version; if ( derivedVersion == null ) { derivedVersion = VersionSupport.UNKNOWN; } String snapshot = "-SNAPSHOT"; if ( derivedVersion.contains( snapshot ) ) { derivedVersion = asRawVersion( version.replace( snapshot, "" ), timestamp, sequence ); } return derivedVersion; }  }
VersionFormatter { public static String asCanonicalVersion( String version, String timestamp, String sequence ) { String derivedVersion = version; if ( derivedVersion == null ) { derivedVersion = VersionSupport.UNKNOWN; } String snapshot = "-SNAPSHOT"; if ( derivedVersion.contains( snapshot ) ) { derivedVersion = asRawVersion( version.replace( snapshot, "" ), timestamp, sequence ); } return derivedVersion; }  static String asRawVersion( String version, String timestamp, String sequence ); static String asCanonicalVersion( String version, String timestamp, String sequence ); }
VersionFormatter { public static String asCanonicalVersion( String version, String timestamp, String sequence ) { String derivedVersion = version; if ( derivedVersion == null ) { derivedVersion = VersionSupport.UNKNOWN; } String snapshot = "-SNAPSHOT"; if ( derivedVersion.contains( snapshot ) ) { derivedVersion = asRawVersion( version.replace( snapshot, "" ), timestamp, sequence ); } return derivedVersion; }  static String asRawVersion( String version, String timestamp, String sequence ); static String asCanonicalVersion( String version, String timestamp, String sequence );  }