### Question:
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);  }### Answer:
@Test public void canonicalVersionShouldNotConatainSnapshotWhenVersionIsSnapshot() { assertThat( VersionFormatter.asCanonicalVersion( "1.0-SNAPSHOT", "201009291818", "1" ), not( containsString( "SNAPSHOT" ) ) ); }
@Test public void canonicalVersionShouldOnlyContainVersionNumberWhenVersionIsRelease() { assertThat( VersionFormatter.asCanonicalVersion( "1.0", "201009291818", "1" ), equalTo( "1.0" ) ); }