@Test
public void addEvents() throws Exception {

    int numTenants = 2;
    int numTriggers = 5;
    int numEvents = 100;
    createTestEvents(numTenants, numTriggers, numEvents);
    Set<String> tenantIds = new HashSet<>();
    tenantIds.add("tenant0");
    tenantIds.add("tenant1");
    assertEquals(2 * 5 * 100, alerts.getEvents(tenantIds, null, null).size());
    tenantIds.remove("tenant0");
    assertEquals(1 * 5 * 100, alerts.getEvents(tenantIds, null, null).size());
    List<Event> testEvents = alerts.getEvents(tenantIds, null, null);
    tenantIds.clear();
    Set<String> eventIds = new HashSet<>();
    for (int i = 0; i < 3; i++) {
        Event eventX = testEvents.get(i);
        tenantIds.add(eventX.getTenantId());
        eventIds.add(eventX.getId());
    }
    EventsCriteria criteria = new EventsCriteria();
    criteria.setEventIds(eventIds);
    assertEquals(3, alerts.getEvents(tenantIds, criteria, null).size());
    deleteTestEvents(numTenants);
}