@Test
public void testShouldThrowExceptionWhenSnapshotReturnsNullForGivenVersion()
    throws DhisVersionMismatchException
{

    MetadataSyncParams syncParams = Mockito.mock( MetadataSyncParams.class );
    MetadataVersion metadataVersion = new MetadataVersion( "testVersion", VersionType.ATOMIC );
    when( syncParams.getVersion() ).thenReturn( metadataVersion );
    when( metadataVersionDelegate.downloadMetadataVersionSnapshot( metadataVersion ) ).thenReturn( null );
    expectedException.expect( MetadataSyncServiceException.class );
    expectedException.expectMessage( "Metadata snapshot can't be null." );
    metadataSyncService.doMetadataSync( syncParams );
}