Skip to content

Commit 8dd2cdc

Browse files
committed
Modify now failing tests after changes
These two tests now fail after moving away from using thread time. - notShowNotificationPastTTL - shouldSetExpireTimeCorrectlyWhenMissingFromPayload Modify the test code to not use thread time
1 parent ad2227c commit 8dd2cdc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

OneSignalSDK/unittest/src/test/java/com/test/onesignal/GenerateNotificationRunner.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,15 +1252,15 @@ public void shouldSetExpireTimeCorrectlyFromGoogleTTL() throws Exception {
12521252
@Test
12531253
@Config (sdk = 23, shadows = { ShadowGenerateNotification.class })
12541254
public void notShowNotificationPastTTL() throws Exception {
1255-
long sentTime = time.getCurrentThreadTimeMillis();
1255+
long sentTime = time.getCurrentTimeMillis();
12561256
long ttl = 60L;
12571257

12581258
Bundle bundle = getBaseNotifBundle();
12591259
bundle.putLong(OneSignalPackagePrivateHelper.GOOGLE_SENT_TIME_KEY, sentTime);
12601260
bundle.putLong(OneSignalPackagePrivateHelper.GOOGLE_TTL_KEY, ttl);
12611261

12621262
// Go forward just past the TTL of the notification
1263-
time.advanceThreadTimeBy(ttl + 1);
1263+
time.advanceSystemTimeBy(ttl + 1);
12641264

12651265
NotificationBundleProcessor_ProcessFromFCMIntentService(blankActivity, bundle);
12661266
threadAndTaskWait();
@@ -1275,7 +1275,7 @@ public void shouldSetExpireTimeCorrectlyWhenMissingFromPayload() throws Exceptio
12751275
threadAndTaskWait();
12761276

12771277
long expireTime = (Long)TestHelpers.getAllNotificationRecords(dbHelper).get(0).get(NotificationTable.COLUMN_NAME_EXPIRE_TIME);
1278-
assertEquals((SystemClock.currentThreadTimeMillis() / 1_000L) + 259_200, expireTime);
1278+
assertEquals((System.currentTimeMillis() / 1_000L) + 259_200, expireTime);
12791279
}
12801280

12811281
// TODO: Once we figure out the correct way to process notifications with high priority using the WorkManager

0 commit comments

Comments
 (0)