  @Test
  public void testAddNewRecordTimeout() throws InterruptedException {

    long timeBucketIntervalInSec = 60;
    int reportFreqMsgCount = 10;
    short reportFreqIntervalSec = 2;
    AuditAggregator agg = new AuditAggregator(timeBucketIntervalInSec, reportFreqMsgCount, reportFreqIntervalSec);

    int partition = 0;
    long offset = 1024;

    long nowInMs = System.currentTimeMillis();
    JSONObject record = createRecordMock("mytopic", 2, 5, 95, nowInMs);

    EasyMock.replay(record);

    assertFalse(agg.addRecord(AUDIT_TOPIC, partition, offset, record));

    Thread.sleep(3000);

    assertTrue(agg.addRecord(AUDIT_TOPIC, partition, offset, record));

    EasyMock.verify(record);
  }