public void testDeployDisplayInformation_whenNull() throws Exception {
    MetadataStubExt mockMetadataStub = mock(MetadataStubExt.class);
    when(mockMetadataStub.getServerName()).thenReturn("test-end-point-server");

    DeployResultAdapter deployResult =
        new DeployResultAdapter(mock(AsyncResult.class), mockMetadataStub);
    assertEquals(
        "Polling server test-end-point-server for response",
        deployResult.retrieveRealTimeStatusUpdatesIfAny());
  }
  public void testRetrieveDisplayInformation_whenNotNull() throws Exception {
    MetadataStubExt mockMetadataStub = mock(MetadataStubExt.class);
    RetrieveResult mockRetrieveResult = mock(RetrieveResult.class);
    AsyncResult mockAsyncResult = mock(AsyncResult.class);

    when(mockAsyncResult.getId()).thenReturn("");
    when(mockRetrieveResult.getStatus()).thenReturn(RetrieveStatus.InProgress);
    when(mockMetadataStub.checkRetrieveStatus(anyString())).thenReturn(mockRetrieveResult);

    RetrieveResultAdapter retrieveResultAdapter =
        new RetrieveResultAdapter(mockAsyncResult, mockMetadataStub);
    retrieveResultAdapter.checkStatus();

    verify(mockAsyncResult, times(1)).getId();
    assertTrue(
        retrieveResultAdapter
            .retrieveRealTimeStatusUpdatesIfAny()
            .contains("Request status: InProgress"));
  }
  public void testDeployDisplayInformation_whenNotNull() throws Exception {
    MetadataStubExt mockMetadataStub = mock(MetadataStubExt.class);
    DeployResult mockDeployResult = mock(DeployResult.class);
    AsyncResult mockAsyncResult = mock(AsyncResult.class);

    when(mockAsyncResult.getId()).thenReturn("");
    when(mockDeployResult.getStatus()).thenReturn(DeployStatus.InProgress);
    when(mockDeployResult.getNumberComponentsDeployed()).thenReturn(1);
    when(mockDeployResult.getNumberComponentsTotal()).thenReturn(10);
    when(mockMetadataStub.checkDeployStatus(anyString())).thenReturn(mockDeployResult);

    DeployResultAdapter deployResultAdapter =
        new DeployResultAdapter(mockAsyncResult, mockMetadataStub);
    deployResultAdapter.checkStatus();

    verify(mockAsyncResult, times(1)).getId();
    assertTrue(
        deployResultAdapter
            .retrieveRealTimeStatusUpdatesIfAny()
            .contains("Deploy status: InProgress (1/10)"));
  }