@Test
public void testGetAllVersionsInBetween() throws Exception
{

    DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern( "yyyy-MM-dd HH:mm:ssZ" );
    org.joda.time.DateTime dateTime1 = dateTimeFormatter.parseDateTime( "2016-06-20 10:45:50Z" );
    org.joda.time.DateTime dateTime2 = dateTimeFormatter.parseDateTime( "2016-06-21 10:45:50Z" );
    org.joda.time.DateTime dateTime3 = dateTimeFormatter.parseDateTime( "2016-06-22 10:45:50Z" );
    assertEquals( 0, metadataVersionStore.getAllVersionsInBetween( new Date(), new Date() ).size() );
    MetadataVersion metadataVersion2 = new MetadataVersion( "version2", VersionType.ATOMIC );
    metadataVersion2.setHashCode( "12222" );
    metadataVersion2.setCreated( dateTime1.toDate() );
    metadataVersionStore.save( metadataVersion2 );
    MetadataVersion metadataVersion3 = new MetadataVersion( "version3", VersionType.ATOMIC );
    metadataVersion3.setHashCode( "12255" );
    metadataVersion3.setCreated( dateTime2.toDate() );
    metadataVersionStore.save( metadataVersion3 );
    MetadataVersion metadataVersion4 = new MetadataVersion( "version4", VersionType.ATOMIC );
    metadataVersion4.setHashCode( "12267" );
    metadataVersion4.setCreated( dateTime3.toDate() );
    metadataVersionStore.save( metadataVersion4 );
    List<MetadataVersion> allVersionsInBetween = metadataVersionStore.getAllVersionsInBetween( dateTime1.toDate(), dateTime2.toDate() );
    assertEquals( 2, allVersionsInBetween.size() );
    assertEquals( metadataVersion2, allVersionsInBetween.get( 0 ) );
    assertEquals( metadataVersion3, allVersionsInBetween.get( 1 ) );
    assertEquals( 0, metadataVersionStore.getAllVersionsInBetween( new Date(), new Date() ).size() );
    metadataVersionStore.delete( metadataVersion2 );
    metadataVersionStore.delete( metadataVersion3 );
    metadataVersionStore.delete( metadataVersion4 );
}