### Question:
MonetDbVersion implements Comparable<MonetDbVersion> { @Override public int compareTo( MonetDbVersion mDbVersion ) { int result = majorVersion.compareTo( mDbVersion.majorVersion ); if ( result != 0 ) { return result; } result = minorVersion.compareTo( mDbVersion.minorVersion ); if ( result != 0 ) { return result; } result = patchVersion.compareTo( mDbVersion.patchVersion ); if ( result != 0 ) { return result; } return result; } MonetDbVersion();  MonetDbVersion( int majorVersion, int minorVersion, int patchVersion );  MonetDbVersion( String productVersion ); Integer getMinorVersion(); Integer getMajorVersion(); Integer getPatchVersion(); @Override int compareTo( MonetDbVersion mDbVersion ); @Override String toString(); static final MonetDbVersion JAN_2014_SP2_DB_VERSION; }### Answer:
@Test public void testCompareVersions_DiffInPatch() throws Exception { String dbVersionBigger = "785.2.3"; String dbVersion = "785.2.2"; assertEquals( 1, new MonetDbVersion( dbVersionBigger ).compareTo( new MonetDbVersion( dbVersion ) ) ); }
@Test public void testCompareVersions_DiffInMinor() throws Exception { String dbVersionBigger = "785.5.3"; String dbVersion = "785.2.2"; assertEquals( 1, new MonetDbVersion( dbVersionBigger ).compareTo( new MonetDbVersion( dbVersion ) ) ); }
@Test public void testCompareVersions_DiffInMajor() throws Exception { String dbVersionBigger = "786.5.3"; String dbVersion = "785.2.2"; assertEquals( 1, new MonetDbVersion( dbVersionBigger ).compareTo( new MonetDbVersion( dbVersion ) ) ); }
@Test public void testCompareVersions_DiffInMajor_LongVersion() throws Exception { String dbVersionBigger = "788.5.3.8.9.7.5"; String dbVersion = "785.2.2"; assertEquals( 1, new MonetDbVersion( dbVersionBigger ).compareTo( new MonetDbVersion( dbVersion ) ) ); }
@Test public void testCompareVersions_TheSame() throws Exception { String dbVersionBigger = "11.11.7"; String dbVersion = "11.11.7"; assertEquals( 0, new MonetDbVersion( dbVersionBigger ).compareTo( new MonetDbVersion( dbVersion ) ) ); }
@Test public void testCompareVersions_NoPatch() throws Exception { String dbVersionBigger = "11.18"; String dbVersion = "11.17.17"; assertEquals( 1, new MonetDbVersion( dbVersionBigger ).compareTo( new MonetDbVersion( dbVersion ) ) ); }