@Test
public void testIsApplicable() throws Exception {

  final Cluster cluster = Mockito.mock(Cluster.class);
  final Map<String, Service> services = new HashMap<>();
  final Service service = Mockito.mock(Service.class);
  services.put("YARN", service);
  Mockito.when(cluster.getServices()).thenReturn(services);
  Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
  Mockito.when(cluster.getClusterId()).thenReturn(1L);
  Assert.assertTrue(servicesMapReduceDistributedCacheCheck.isApplicable(new PrereqCheckRequest("cluster")));
  PrereqCheckRequest req = new PrereqCheckRequest("cluster");
  req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.FAIL);
  Assert.assertFalse(servicesMapReduceDistributedCacheCheck.isApplicable(req));
  req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.PASS);
  Assert.assertTrue(servicesMapReduceDistributedCacheCheck.isApplicable(req));
  services.remove("YARN");
  Assert.assertFalse(servicesMapReduceDistributedCacheCheck.isApplicable(new PrereqCheckRequest("cluster")));
}