@Test
public void testPerform() throws Exception {

  final Cluster cluster = Mockito.mock(Cluster.class);
  Mockito.when(cluster.getClusterId()).thenReturn(1L);
  Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
  final Service service = Mockito.mock(Service.class);
  final ServiceComponent serviceComponent = Mockito.mock(ServiceComponent.class);
  Mockito.when(cluster.getService("HDFS")).thenReturn(service);
  Mockito.when(service.getServiceComponent("SECONDARY_NAMENODE")).thenReturn(serviceComponent);
  Mockito.when(serviceComponent.getServiceComponentHosts()).thenReturn(Collections.<String, ServiceComponentHost>singletonMap("host", null));
  PrerequisiteCheck check = new PrerequisiteCheck(null, null);
  secondaryNamenodeDeletedCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
  Assert.assertEquals("HDFS", check.getFailedOn().toArray(new String[1])[0]);
  Assert.assertEquals("The SNameNode component must be deleted from host: host.", check.getFailReason());
  Mockito.when(serviceComponent.getServiceComponentHosts()).thenReturn(Collections.<String, ServiceComponentHost> emptyMap());
  check = new PrerequisiteCheck(null, null);
  secondaryNamenodeDeletedCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}