### Question:
RangerAuditDbCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { String propertyValue = getProperty(request, "ranger-admin-site", "ranger.audit.source.type"); if (null != propertyValue && propertyValue.equalsIgnoreCase("db")) { prerequisiteCheck.getFailedOn().add(serviceName); prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } RangerAuditDbCheck(); @Override Set<String> getApplicableServices(); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }### Answer:
@Test public void testPerform() 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("RANGER", service); Mockito.when(cluster.getServices()).thenReturn(services); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("ranger-admin-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); properties.put("ranger.audit.source.type", "db"); PrerequisiteCheck check = new PrerequisiteCheck(null, null); rangerAuditDbCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.WARNING, check.getStatus()); properties.put("ranger.audit.source.type", "solr"); check = new PrerequisiteCheck(null, null); rangerAuditDbCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus()); }