diff --git a/OneSignalSDK/unittest/src/test/java/com/test/onesignal/GenerateNotificationRunner.java b/OneSignalSDK/unittest/src/test/java/com/test/onesignal/GenerateNotificationRunner.java index 7775bce82c..66bcc82014 100644 --- a/OneSignalSDK/unittest/src/test/java/com/test/onesignal/GenerateNotificationRunner.java +++ b/OneSignalSDK/unittest/src/test/java/com/test/onesignal/GenerateNotificationRunner.java @@ -74,7 +74,6 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.SystemClock; import android.util.Log; import androidx.annotation.NonNull; @@ -450,6 +449,34 @@ public void testGrouplessSummaryNotificationIsDismissedOnClear() throws Exceptio assertEquals(0, postedNotifs.size()); } + @Test + @Config(sdk = Build.VERSION_CODES.N, shadows = { ShadowGenerateNotification.class }) + public void testIndividualGrouplessSummaryNotificationDismissal() throws Exception { + OneSignal.setAppId("b2f7f966-d8cc-11e4-bed1-df8f05be55ba"); + OneSignal.initWithContext(blankActivity.getApplicationContext()); + threadAndTaskWait(); + + // Add 4 groupless notifications + postNotificationWithOptionalGroup(4, null); + threadAndTaskWait(); + + // Obtain the posted notifications + Map postedNotifs = ShadowRoboNotificationManager.notifications; + Iterator> iterator = postedNotifs.entrySet().iterator(); + Map.Entry entry = iterator.next(); + Map.Entry entry2 = iterator.next(); + Map.Entry entry3 = iterator.next(); + Map.Entry entry4 = iterator.next(); + Integer id4 = entry4.getKey(); + assertNotNull(id4); + + assertEquals(5, postedNotifs.size()); + // Clear a OneSignal Notification + OneSignal.removeNotification(id4); + threadAndTaskWait(); + assertEquals(4, postedNotifs.size()); + } + @Test @Config(sdk = Build.VERSION_CODES.LOLLIPOP, shadows = { ShadowGenerateNotification.class }) public void testNotifDismissAllOnGroupSummaryClickForAndroidUnderM() throws Exception {