urbanairship-core/src/test/java/com/urbanairship/analytics/data/EventManagerTest.java
@Test
    public void testAddEventBeforeNextSendTime() {
        // Set the last send time to the current time so the next send time is minBatchInterval
        dataStore.put(EventManager.LAST_SEND_KEY, System.currentTimeMillis());

        // Set the minBatchInterval to 20 seconds
        dataStore.put(MIN_BATCH_INTERVAL_KEY, 20000);

        CustomEvent customEvent = CustomEvent.newBuilder("event name").build();
        eventManager.addEvent(customEvent, "session");

        // Check it schedules an upload with a time greater than 10 seconds
        verify(mockDispatcher).dispatch(Mockito.argThat(new ArgumentMatcher<JobInfo>() {
            @Override
            public boolean matches(JobInfo jobInfo) {
                return jobInfo.getAction().equals("upload") && jobInfo.getInitialDelay() > 10000;
            }
        }));
    }
/**
     * Tests adding an event  before the next send time schedules an upload with the remaining delay.
     */
Tests adding an event  before the next send time schedules an upload with the remaining delay.
Tests adding an event before the next send time schedules an upload with the remaining delay .
@Test
    public void testAddEventBeforeNextSendTime() {
        dataStore.put(EventManager.LAST_SEND_KEY, System.currentTimeMillis());
        dataStore.put(MIN_BATCH_INTERVAL_KEY, 20000);
        CustomEvent customEvent = CustomEvent.newBuilder("event name").build();
        eventManager.addEvent(customEvent, "session");
        verify(mockDispatcher).dispatch(Mockito.argThat(new ArgumentMatcher<JobInfo>() {
            @Override
            public boolean matches(JobInfo jobInfo) {
                return jobInfo.getAction().equals("upload") && jobInfo.getInitialDelay() > 10000;
            }
        }));
    }
@ Test public void testAddEventBeforeNextSendTime ( ) { dataStore . put ( EventManager . LAST_SEND_KEY , System . currentTimeMillis ( ) ) ; dataStore . put ( MIN_BATCH_INTERVAL_KEY , 20000 ) ; CustomEvent customEvent = CustomEvent . newBuilder ( "event name" ) . build ( ) ; eventManager . addEvent ( customEvent , "session" ) ; verify ( mockDispatcher ) . dispatch ( Mockito . argThat ( new ArgumentMatcher < JobInfo > ( ) { @ Override public boolean matches ( JobInfo jobInfo ) { return jobInfo . getAction ( ) . equals ( "upload" ) && jobInfo . getInitialDelay ( ) > 10000 ; } } ) ) ; }
Tests adding an event  before the next send time schedules an upload with the remaining delay.
Tests adding an event before the next send time schedules an upload with the remaining delay .
// Set the last send time to the current time so the next send time is minBatchInterval // Set the minBatchInterval to 20 seconds // Check it schedules an upload with a time greater than 10 seconds