SubscriptionInAppPurchaseConsumer implements InAppPurchaseConsumer<Subscription> { @Override public boolean isConsumed(@NonNull Subscription managedProduct, @NonNull PurchaseFamily purchaseFamily) { final Set<String> consumedSubscriptionSkuSet = sharedPreferences.get().getStringSet(KEY_CONSUMED_SUBSCRIPTION_SET, Collections.emptySet()); for (final String sku : consumedSubscriptionSkuSet) { if (managedProduct.getInAppPurchase().equals(InAppPurchase.from(sku))) { final String family = sharedPreferences.get().getString(getPurchaseFamilyKey(sku), ""); if (purchaseFamily.name().equals(family)) { return true; } } } return false; } @Inject  SubscriptionInAppPurchaseConsumer(@NonNull Lazy<SharedPreferences> preferences); @Override boolean isConsumed(@NonNull Subscription managedProduct, @NonNull PurchaseFamily purchaseFamily); @Override Completable consumePurchase(@NonNull Subscription managedProduct, @NonNull PurchaseFamily purchaseFamily);  }
@Test public void isConsumedReturnsFalseForEmpty() { assertFalse(subscriptionInAppPurchaseConsumer.isConsumed(subscription, PurchaseFamily.Ocr)); }