@Test
public void shouldReturnATSUrlFromYarnSiteInClusteredMode() throws Exception {

  ViewContext viewContext = getViewContext(new HashMap<String, String>());
  AmbariApi ambariApi = createNiceMock(AmbariApi.class);
  Cluster cluster = createNiceMock(Cluster.class);
  Services services = new Services(ambariApi, viewContext);
  expect(ambariApi.isClusterAssociated()).andReturn(true).anyTimes();
  setClusterExpectation(cluster, "HTTP_ONLY");
  expect(viewContext.getCluster()).andReturn(cluster).anyTimes();
  replayAll();
  assertEquals(HTTP_RM_URL1, services.getTimelineServerUrl());
  reset(cluster);
  setClusterExpectation(cluster, "HTTPS_ONLY");
  replay(cluster);
  assertEquals(HTTPS_RM_URL2, services.getTimelineServerUrl());
}