Skip to content

Commit

Permalink
Fix CatchFail warning for ShadowWifiP2pManagerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
utzcoz authored and MGaetan89 committed Dec 2, 2024
1 parent 3ac9046 commit d0e70a3
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static android.os.Build.VERSION_CODES.O;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import static org.robolectric.Shadows.shadowOf;
import static org.robolectric.shadows.ShadowLooper.shadowMainLooper;

Expand All @@ -14,6 +13,7 @@
import android.os.Looper;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
Expand Down Expand Up @@ -203,7 +203,8 @@ public void wifiP2pManager_activityContextEnabled_retrievesSameGroupInfo() {
}

WifiP2pManager.Channel activityChannel =
activityWifiP2pManager.initialize(activity, activity.getMainLooper(), null);
Objects.requireNonNull(activityWifiP2pManager)
.initialize(activity, activity.getMainLooper(), null);

activityWifiP2pManager.requestGroupInfo(
activityChannel,
Expand All @@ -218,7 +219,7 @@ public void wifiP2pManager_activityContextEnabled_retrievesSameGroupInfo() {

assertThat(applicationGroupNameHolder[0]).isEqualTo(activityGroupNameHolder[0]);
} catch (InterruptedException e) {
fail("Failed because of latch interrupt");
throw new AssertionError("Failed because of latch interrupt", e);
} finally {
System.setProperty("robolectric.createActivityContexts", originalProperty);
}
Expand Down

0 comments on commit d0e70a3

Please sign in to comment.