Switch the mocking session strictness to WARN from STRICT KeyguardUpdateMonitorTest

The stubbing is not great in this test, not all flows are stubbed out properly,
if a device is not provisioned when the test runs, mockito complains quite a bit
about either unmatched stubs or unnecessary stubbing.

Bug: 277873197
Test: atest KeyguardUpdateMonitorTest
Test: force mDeviceProvisioned flag to false in KeyguardUpdateMonitor
      run the test, it should not fail
Change-Id: I5adf4e50e1fa93807dc2e6bab53ddc78963605f6
This commit is contained in:
Chandru S
2023-04-13 12:20:44 -07:00
parent e3c8965517
commit 5e53ad62ae

View File

@@ -155,6 +155,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.MockitoSession;
import org.mockito.internal.util.reflection.FieldSetter;
import org.mockito.quality.Strictness;
import java.util.ArrayList;
import java.util.Arrays;
@@ -303,6 +304,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
mMockitoSession = ExtendedMockito.mockitoSession()
.spyStatic(SubscriptionManager.class)
.strictness(Strictness.WARN)
.startMocking();
ExtendedMockito.doReturn(SubscriptionManager.INVALID_SUBSCRIPTION_ID)
.when(SubscriptionManager::getDefaultSubscriptionId);