@Test
public void testHandleMetadataVersionsListShouldReturnDifferenceOfVersionsFromBaselineVersion() throws Exception
{

    MetadataRetryContext mockRetryContext = mock( MetadataRetryContext.class );
    MetadataVersion currentVersion = new MetadataVersion();
    currentVersion.setType( VersionType.BEST_EFFORT );
    currentVersion.setName( "test_version1" );
    currentVersion.setCreated( new Date() );
    currentVersion.setHashCode( "samplehashcode1" );
    MetadataVersion newVersion = new MetadataVersion();
    newVersion.setType( VersionType.ATOMIC );
    newVersion.setName( "test_version2" );
    newVersion.setCreated( new Date() );
    newVersion.setHashCode( "samplehashcode2" );
    List<MetadataVersion> listOfVersions = new ArrayList<>();
    listOfVersions.add( newVersion );
    when( metadataVersionDelegate.getMetaDataDifference( currentVersion ) ).thenReturn( listOfVersions );
    List<MetadataVersion> expectedListOfVersions = metadataSyncPreProcessor.handleMetadataVersionsList( mockRetryContext, currentVersion );
    assertEquals( listOfVersions.size(), expectedListOfVersions.size() );
    assertEquals( expectedListOfVersions, listOfVersions );
}