@Test
public void queryAlertsByStatus() throws Exception {

    int numTenants = 1;
    int numTriggers = 5;
    int numAlerts = 5;
    createTestAlerts(numTenants, numTriggers, numAlerts);
    Set<String> tenantIds = new HashSet<>();
    tenantIds.add("tenant0");
    AlertsCriteria criteria = new AlertsCriteria();
    criteria.setStatus(Alert.Status.OPEN);
    List<Alert> openAlerts = alerts.getAlerts(tenantIds, criteria, null);
    assertEquals(5, openAlerts.size());
    criteria.setStatus(Alert.Status.ACKNOWLEDGED);
    List<Alert> acknowledgedAlerts = alerts.getAlerts(tenantIds, criteria, null);
    assertEquals(5 * 2, acknowledgedAlerts.size());
    criteria.setStatus(Alert.Status.RESOLVED);
    List<Alert> resolvedAlerts = alerts.getAlerts(tenantIds, criteria, null);
    assertEquals(5 * 2, resolvedAlerts.size());
    criteria.setStatusSet(Arrays.asList(Alert.Status.ACKNOWLEDGED, Alert.Status.RESOLVED));
    List<Alert> ackResolvedAlerts = alerts.getAlerts(tenantIds, criteria, null);
    assertEquals(5 * 4, ackResolvedAlerts.size());
    deleteTestAlerts(numTenants);
}