@Test
public void testCountEvents() throws Exception {

  final long oneHourMillis = 3600_000;
  final long nowMillis = new Date().getTime();
  final String mpId = "mpId";
  final String agentId = "agent1";
  final String orgId = new DefaultOrganization().getId();
  final Date[] eventStartDates = {
      new Date(nowMillis - 4 * oneHourMillis),
      new Date(nowMillis - oneHourMillis),
      new Date(nowMillis + oneHourMillis),
      new Date(nowMillis + 5 * oneHourMillis),
  };
  for (int i = 0; i < 4; i++) {
    final Date start = eventStartDates[i];
    final Date end = new Date(start.getTime() + 2 * oneHourMillis);
    schedulerDatabase.storeEvent(
        mpId + i,
        orgId,
        Opt.some(agentId),
        Opt.some(start),
        Opt.some(end),
        Opt.none(),
        Opt.none(),
        Opt.none(),
        Opt.none(),
        Opt.none(),
        Opt.none(),
        Opt.none(),
        Opt.none()
    );
  }
  int count = schedulerDatabase.countEvents();
  Assert.assertEquals(4, count);
}