我想使用模拟或机器人测试框架为以下代码编写单元测试。
public static Boolean verifyNetworkAboveLollipop(Context context) {
SubscriptionManager subscriptionManager = (SubscriptionManager) context.
getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
if (null != subscriptionManager) {
@SuppressLint("MissingPermission") List<SubscriptionInfo> subscriptionInfoList = subscriptionManager.getActiveSubscriptionInfoList();
if (null != subscriptionInfoList && 0 < subscriptionInfoList.size()) {
for (SubscriptionInfo info : subscriptionInfoList) {
if (null != info && !TextUtils.isEmpty(info.getCarrierName())) {
String carrierName = info.getCarrierName().toString();
if ("Airtel".equalsIgnoreCase(carrierName)) {
return true;
}
}
}
}
}
return false;
}