@Test
public void testShouldGetRemoteMetadataVersionWithStatusOk()
    throws Exception
{

    when( metadataSystemSettingService.getRemoteInstanceUserName() ).thenReturn( username );
    when( metadataSystemSettingService.getRemoteInstancePassword() ).thenReturn( password );
    AvailabilityStatus availabilityStatus = new AvailabilityStatus( true, "testMessage", null );
    DhisHttpResponse dhisHttpResponse = new DhisHttpResponse( httpResponse, response, HttpStatus.OK.value() );
    when( metadataSystemSettingService.getVersionDetailsUrl( "testVersion" ) ).thenReturn( versionUrl );
    when( synchronizationManager.isRemoteServerAvailable() ).thenReturn( availabilityStatus );
    PowerMockito.when( HttpUtils.httpGET( versionUrl, true, username, password, null, VERSION_TIMEOUT, true ) )
        .thenReturn( dhisHttpResponse );
    when( renderService.fromJson( response, MetadataVersion.class ) ).thenReturn( metadataVersion );
    MetadataVersion remoteMetadataVersion = target.getRemoteMetadataVersion( "testVersion" );
    assertEquals( metadataVersion.getType(), remoteMetadataVersion.getType() );
    assertEquals( metadataVersion.getHashCode(), remoteMetadataVersion.getHashCode() );
    assertEquals( metadataVersion.getName(), remoteMetadataVersion.getName() );
    assertEquals( metadataVersion, remoteMetadataVersion );
}