use of org.mockito.compat.ArgumentMatcher in project platform_frameworks_base by android.
the class NetworkScorerAppManagerTest method mockRecommendationServiceAvailable.
private void mockRecommendationServiceAvailable(final String packageName, int packageUid) {
final ResolveInfo serviceInfo = new ResolveInfo();
serviceInfo.serviceInfo = new ServiceInfo();
serviceInfo.serviceInfo.name = ".RecommendationService";
serviceInfo.serviceInfo.packageName = packageName;
serviceInfo.serviceInfo.applicationInfo = new ApplicationInfo();
serviceInfo.serviceInfo.applicationInfo.uid = packageUid;
final int flags = 0;
when(mMockPm.resolveService(Mockito.argThat(new ArgumentMatcher<Intent>() {
@Override
public boolean matchesObject(Object object) {
Intent intent = (Intent) object;
return NetworkScoreManager.ACTION_RECOMMEND_NETWORKS.equals(intent.getAction()) && packageName.equals(intent.getPackage());
}
}), Mockito.eq(flags))).thenReturn(serviceInfo);
}
Aggregations