From c81e744981bd96c5925d08ca1c330cf81ece50d2 Mon Sep 17 00:00:00 2001 From: gdeluna-branch <94577415+gdeluna-branch@users.noreply.github.com> Date: Sat, 14 Oct 2023 01:19:25 -0700 Subject: [PATCH] Update ServerRequestTests.java --- .../io/branch/referral/ServerRequestTests.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Branch-SDK/src/androidTest/java/io/branch/referral/ServerRequestTests.java b/Branch-SDK/src/androidTest/java/io/branch/referral/ServerRequestTests.java index b22d6b377..544e588b3 100644 --- a/Branch-SDK/src/androidTest/java/io/branch/referral/ServerRequestTests.java +++ b/Branch-SDK/src/androidTest/java/io/branch/referral/ServerRequestTests.java @@ -34,7 +34,7 @@ public void tearDown() throws InterruptedException { @Test public void testTimedOutInitSessionCallbackInvoked() { - setTimeouts(1, PrefHelper.CONNECT_TIMEOUT); + setTimeouts(1, 1); initSessionResumeActivity(null, new Runnable() { @Override public void run() { @@ -49,7 +49,7 @@ public void testTimedOutLastAttributedTouchDataCallbackInvoked() { initSessionResumeActivity(null, new Runnable() { @Override public void run() { - setTimeouts(1, PrefHelper.CONNECT_TIMEOUT); + setTimeouts(1, 1); final CountDownLatch lock1 = new CountDownLatch(1); Branch.getInstance().getLastAttributedTouchData(new ServerRequestGetLATD.BranchLastAttributedTouchDataListener() { @@ -76,7 +76,7 @@ public void testTimedOutGenerateShortUrlCallbackInvoked() { initSessionResumeActivity(null, new Runnable() { @Override public void run() { - setTimeouts(1, PrefHelper.CONNECT_TIMEOUT); + setTimeouts(1, 1); final CountDownLatch lock3 = new CountDownLatch(1); BranchUniversalObject buo = new BranchUniversalObject() @@ -100,9 +100,13 @@ public void run() { @Override public void onLinkCreate(String url, BranchError error) { BranchLogger.v("error is " + error); - Assert.assertTrue((BranchError.ERR_BRANCH_REQ_TIMED_OUT == error.getErrorCode()) - || BranchError.ERR_BRANCH_NO_CONNECTIVITY == error.getErrorCode()); - lock3.countDown(); + if (error == null) { + Assert.fail("Error was null"); + } + else { + Assert.assertTrue((BranchError.ERR_BRANCH_REQ_TIMED_OUT == error.getErrorCode()) || BranchError.ERR_BRANCH_NO_CONNECTIVITY == error.getErrorCode()); + lock3.countDown(); + } } }); try {