@@ -1996,8 +1996,9 @@ public void testNotificationWillShowInForegroundHandler_doesNotFireWhenAppBackgr
1996
1996
}
1997
1997
1998
1998
@ Test
1999
- @ Config (shadows = { ShadowGenerateNotification .class , ShadowTimeoutHandler .class })
1999
+ @ Config (shadows = { ShadowGenerateNotification .class , ShadowTimeoutHandler .class , ShadowNotificationReceivedEvent . class })
2000
2000
public void testNotificationWillShowInForegroundHandler_notCallCompleteShowsNotificationAfterTimeout () throws Exception {
2001
+ OneSignal .setLogLevel (OneSignal .LOG_LEVEL .VERBOSE , OneSignal .LOG_LEVEL .NONE );
2001
2002
// 1. Init OneSignal
2002
2003
OneSignal .setAppId ("b2f7f966-d8cc-11e4-bed1-df8f05be55ba" );
2003
2004
OneSignal .initWithContext (blankActivity );
@@ -2022,8 +2023,16 @@ public void testNotificationWillShowInForegroundHandler_notCallCompleteShowsNoti
2022
2023
// 4. Make sure the callback counter is only fired once for App NotificationWillShowInForegroundHandler
2023
2024
assertEquals (1 , callbackCounter );
2024
2025
2025
- // 5. Make sure 1 notification exists in DB
2026
- assertNotificationDbRecords (1 );
2026
+ // Complete being call from Notification Receiver Handler thread
2027
+ Awaitility .await ()
2028
+ .atMost (new Duration (5 , TimeUnit .SECONDS ))
2029
+ .pollInterval (new Duration (500 , TimeUnit .MILLISECONDS ))
2030
+ .untilAsserted (() -> {
2031
+ // 5. Make sure 1 notification exists in DB
2032
+ assertNotificationDbRecords (1 );
2033
+ // 6. Notification not opened then badges should be 1
2034
+ assertEquals (1 , ShadowBadgeCountUpdater .lastCount );
2035
+ });
2027
2036
}
2028
2037
2029
2038
@ Test
0 commit comments