@Test
    public void skipCleanedUpEvents() throws Exception {
        Database db = new Database("cleanup1", "no description", testTempDir, emptyParameters);
        msClient.createDatabase(db);
        msClient.dropDatabase("cleanup1");

        // sleep for expiry time, and then fetch again
        // sleep twice the TTL interval - things should have been cleaned by then.
        Thread.sleep(EVENTS_TTL * 2 * 1000);

        db = new Database("cleanup2", "no description", testTempDir, emptyParameters);
        msClient.createDatabase(db);
        msClient.dropDatabase("cleanup2");

        // the firstEventId is before the cleanup happened, so we should just receive the
        // events which remaining after cleanup.
        NotificationEventRequest request = new NotificationEventRequest();
        request.setLastEvent(firstEventId);
        request.setMaxEvents(-1);
        NotificationEventResponse rsp2 = msClient.getNextNotification(request, true, null);
        assertEquals(2, rsp2.getEventsSize());
        // when we pass the allowGapsInEvents as false the API should error out
        Exception ex = null;
        try {
            NotificationEventResponse rsp = msClient.getNextNotification(request, false, null);
        } catch (Exception e) {
            ex = e;
        }
        assertNotNull(ex);
    }
Test makes sure that if you use the API {@link HiveMetaStoreClient#getNextNotification(NotificationEventRequest, boolean, NotificationFilter)}
does not error out if the events are cleanedup.
itests/hcatalog-unit/src/test/java/org/apache/hive/hcatalog/listener/TestDbNotificationCleanup.java