@Test
public void shouldConnectToDefaultHostPortInClusterModeWhenWebaddressConfigIsEmpty() throws Exception {

  ViewContext viewContext = getViewContext(new HashMap<String, String>());
  AmbariApi ambariApi = createNiceMock(AmbariApi.class);
  Cluster cluster = createNiceMock(Cluster.class);
  expect(ambariApi.isClusterAssociated()).andReturn(true).anyTimes();
  setClusterExpectationWithEmptyWebappConfig(cluster, "HTTP_ONLY");
  expect(viewContext.getCluster()).andReturn(cluster).anyTimes();
  Services services = new Services(ambariApi, viewContext);
  replayAll();
  assertEquals("http://" + RM_URL1_HOST + ":8088", services.getRMUrl());
  reset(cluster);
  setClusterExpectationWithEmptyWebappConfig(cluster, "HTTPS_ONLY");
  replay(cluster);
  assertEquals("https://" + RM_URL1_HOST + ":8090", services.getRMUrl());
}