|
3 | 3 | import android.content.Intent; |
4 | 4 | import android.os.Bundle; |
5 | 5 |
|
6 | | -import com.google.firebase.iid.FirebaseInstanceId; |
7 | 6 | import com.google.firebase.messaging.RemoteMessage; |
8 | 7 |
|
9 | 8 | import org.junit.After; |
|
21 | 20 |
|
22 | 21 | import static com.iterable.iterableapi.IterableTestUtils.bundleToMap; |
23 | 22 | import static junit.framework.Assert.assertEquals; |
| 23 | +import static junit.framework.TestCase.assertFalse; |
| 24 | +import static junit.framework.TestCase.assertTrue; |
24 | 25 | import static org.mockito.ArgumentMatchers.any; |
25 | 26 | import static org.mockito.ArgumentMatchers.eq; |
26 | 27 | import static org.mockito.Mockito.doNothing; |
@@ -112,4 +113,20 @@ public void testSilentPushInAppRemoved() throws Exception { |
112 | 113 | verify(inAppManagerSpy).removeMessage("1234567890abcdef"); |
113 | 114 | } |
114 | 115 |
|
| 116 | + @Test |
| 117 | + public void testIsGhostPushWithGhostPushMessage() throws Exception { |
| 118 | + RemoteMessage. Builder builder = new RemoteMessage. Builder( "[email protected]"); |
| 119 | + builder.setData(IterableTestUtils.getMapFromJsonResource("push_payload_ghost_push.json")); |
| 120 | + assertTrue(IterableFirebaseMessagingService.isGhostPush(builder.build())); |
| 121 | + verify(notificationHelperSpy).isGhostPush(any(Bundle.class)); |
| 122 | + } |
| 123 | + |
| 124 | + @Test |
| 125 | + public void testIsGhostPushWithNotificationMessage() throws Exception { |
| 126 | + RemoteMessage. Builder builder = new RemoteMessage. Builder( "[email protected]"); |
| 127 | + builder.setData(IterableTestUtils.getMapFromJsonResource("push_payload_legacy_deep_link.json")); |
| 128 | + assertFalse(IterableFirebaseMessagingService.isGhostPush(builder.build())); |
| 129 | + verify(notificationHelperSpy).isGhostPush(any(Bundle.class)); |
| 130 | + } |
| 131 | + |
115 | 132 | } |
0 commit comments