### Question:
Version { public static String setSnapshot( String version, boolean snapshot ) { if ( isEmpty( version ) ) { return EMPTY_STRING; } if ( isSnapshot( version ) == snapshot ) { return version; } else if ( snapshot ) { return (version + DEFAULT_QUALIFIER_DELIMITER + SNAPSHOT_SUFFIX); } else { return removeSnapshot( version ); } } private  Version(); static String getBuildNumber(String version); static int getBuildNumberPadding( int incrementalSerialSuffixPadding, Set<String> versions ); static String getMMM(String version); static String getOsgiVersion(String version); static String getQualifier(String version); static String getQualifierBase(String version); static String getQualifierWithDelim(String version); static String getSnapshot( String version ); static String getSnapshotWithDelim( String version ); static boolean hasBuildNumber( String version ); static boolean hasQualifier( String version ); static boolean isEmpty( String string ); static boolean isSnapshot( String version ); static boolean isValidOSGi(String version); static String removeBuildNumber( String version ); static String removeSnapshot( String version ); static String appendQualifierSuffix( final String version, final String suffix ); static String setBuildNumber( String version, String buildNumber ); static String setSnapshot( String version, boolean snapshot ); static int findHighestMatchingBuildNumber(String version, Set<String> versionSet ); static int getIntegerBuildNumber( String version ); static final String PROJECT_VERSION; }### Answer:
@Test public void testSetSnapshot() { assertThat( Version.setSnapshot( "1.0-SNAPSHOT", true ), equalTo( "1.0-SNAPSHOT" ) ); assertThat( Version.setSnapshot( "1.0-SNAPSHOT", false ), equalTo( "1.0" ) ); assertThat( Version.setSnapshot( "1.1", true ), equalTo( "1.1-SNAPSHOT" ) ); assertThat( Version.setSnapshot( "1.1", false ), equalTo( "1.1" ) ); assertThat( Version.setSnapshot( "1.2.jboss-1", true ), equalTo( "1.2.jboss-1-SNAPSHOT" ) ); assertThat( Version.setSnapshot( "1.2.jboss-1", false ), equalTo( "1.2.jboss-1" ) ); assertThat( Version.setSnapshot( "1.0.0.Beta1_snapshot", true ), equalTo( "1.0.0.Beta1_snapshot" ) ); assertThat( Version.setSnapshot( "1.0.0.Beta1_snapshot", false ), equalTo( "1.0.0.Beta1" ) ); assertThat( Version.setSnapshot( "1.snaPsHot", true ), equalTo( "1.snaPsHot" ) ); assertThat( Version.setSnapshot( "1.snaPsHot", false ), equalTo( "1" ) ); assertThat( Version.setSnapshot( "SNAPSHOT", true ), equalTo( "SNAPSHOT" ) ); assertThat( Version.setSnapshot( "SNAPSHOT", false ), equalTo( "" ) ); assertThat( Version.setSnapshot( "1.0.snapshot.beta1", true ), equalTo( "1.0.snapshot.beta1-SNAPSHOT" ) ); assertThat( Version.setSnapshot( "1.0.snapshot.beta1", false ), equalTo( "1.0.snapshot.beta1" ) ); }