### Question:
ServicesTezDistributedCacheCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { if (!super.isApplicable(request, Arrays.asList("TEZ"), true)) { return false; } PrereqCheckStatus ha = request.getResult(CheckDescription.SERVICES_NAMENODE_HA); if (null != ha && ha == PrereqCheckStatus.FAIL) { return false; } return true; } ServicesTezDistributedCacheCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }### Answer:
@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("TEZ", service); Mockito.when(cluster.getServices()).thenReturn(services); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); Assert.assertTrue(servicesTezDistributedCacheCheck.isApplicable(new PrereqCheckRequest("cluster"))); PrereqCheckRequest req = new PrereqCheckRequest("cluster"); req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.FAIL); Assert.assertFalse(servicesTezDistributedCacheCheck.isApplicable(req)); req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.PASS); Assert.assertTrue(servicesTezDistributedCacheCheck.isApplicable(req)); services.remove("TEZ"); Assert.assertFalse(servicesTezDistributedCacheCheck.isApplicable(new PrereqCheckRequest("cluster"))); }