Fix JobSchedulerTest.
ServiceManager wasn't being mocked so the test kept failing with "java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.android.server.compat.PlatformCompat". Adding the mocking fixes the tests. Bug: N/A Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest Change-Id: I07148319f8dd4a31a83b43410f9e06e932faa103
This commit is contained in:
@@ -50,6 +50,7 @@ import android.net.NetworkPolicyManager;
|
||||
import android.os.BatteryManagerInternal;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.android.server.AppStateTracker;
|
||||
@@ -95,6 +96,7 @@ public class JobSchedulerServiceTest {
|
||||
.initMocks(this)
|
||||
.strictness(Strictness.LENIENT)
|
||||
.mockStatic(LocalServices.class)
|
||||
.mockStatic(ServiceManager.class)
|
||||
.startMocking();
|
||||
|
||||
// Called in JobSchedulerService constructor.
|
||||
|
||||
Reference in New Issue
Block a user