urbanairship-core/src/test/java/com/urbanairship/analytics/AnalyticsTest.java
@Test
    public void testOnForeground() {
        // Start analytics in the background
        analytics.onBackground(0);

        assertFalse(analytics.isAppInForeground());

        // Grab the session id to compare it to a new session id
        String sessionId = analytics.getSessionId();

        analytics.onForeground(0);

        // Verify that we generate a new session id
        assertNotNull(analytics.getSessionId());
        assertNotSame("A new session id should be generated on foreground", analytics.getSessionId(), sessionId);
    }
/**
     * Test that when the app goes into the foreground, a new
     * session id is created, a broadcast is sent for foreground, isAppForegrounded
     * is set to true, and a foreground event job is dispatched.
     */
Test that when the app goes into the foreground, a new
session id is created, a broadcast is sent for foreground, isAppForegrounded
is set to true, and a foreground event job is dispatched.
Test that when the app goes into the foreground a new session id is created a broadcast is sent for foreground isAppForegrounded is set to true and a foreground event job is dispatched .
@Test
    public void testOnForeground() {
        analytics.onBackground(0);
        assertFalse(analytics.isAppInForeground());
        String sessionId = analytics.getSessionId();
        analytics.onForeground(0);
        assertNotNull(analytics.getSessionId());
        assertNotSame("A new session id should be generated on foreground", analytics.getSessionId(), sessionId);
    }
@ Test public void testOnForeground ( ) { analytics . onBackground ( 0 ) ; assertFalse ( analytics . isAppInForeground ( ) ) ; String sessionId = analytics . getSessionId ( ) ; analytics . onForeground ( 0 ) ; assertNotNull ( analytics . getSessionId ( ) ) ; assertNotSame ( "A new session id should be generated on foreground" , analytics . getSessionId ( ) , sessionId ) ; }
Test that when the app goes into the foreground, a new
 session id is created, a broadcast is sent for foreground, isAppForegrounded
 is set to true, and a foreground event job is dispatched.
Test that when the app goes into the foreground a new session id is created a broadcast is sent for foreground isAppForegrounded is set to true and a foreground event job is dispatched .
// Start analytics in the background // Grab the session id to compare it to a new session id // Verify that we generate a new session id