### Question:
HealthCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { AlertsDAO alertsDAO = alertsDAOProvider.get(); final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); List<AlertCurrentEntity> alerts = alertsDAO.findCurrentByCluster(cluster.getClusterId()); List<String> errorMessages = new ArrayList<>(); for (AlertCurrentEntity alert : alerts) { AlertHistoryEntity alertHistory = alert.getAlertHistory(); AlertState alertState = alertHistory.getAlertState(); if (ALERT_STATES.contains(alertState) && !alert.getMaintenanceState().equals(MaintenanceState.ON)) { String state = alertState.name(); String label = alertHistory.getAlertDefinition().getLabel(); String hostName = alertHistory.getHostName(); if (hostName == null) { errorMessages.add(state + ": " + label); } else { errorMessages.add(state + ": " + label + ": " + hostName); } prerequisiteCheck.getFailedDetail().add(new AlertDetail(state, label, hostName)); } } if (!errorMessages.isEmpty()) { prerequisiteCheck.getFailedOn().add(clusterName); prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); String failReason = getFailReason(prerequisiteCheck, request); prerequisiteCheck.setFailReason( String.format(failReason, StringUtils.join(errorMessages, System.lineSeparator()))); } } HealthCheck(); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }### Answer:
@Test public void testWarningWhenNoAlertsExist() throws AmbariException { when(alertsDAO.findCurrentByCluster(eq(CLUSTER_ID))).thenReturn(Collections.emptyList()); PrerequisiteCheck check = new PrerequisiteCheck(null, CLUSTER_NAME); healthCheck.perform(check, new PrereqCheckRequest(CLUSTER_NAME)); Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus()); Assert.assertTrue(check.getFailedDetail().isEmpty()); }