### Question:
IabHelper { public void consumeAsync(Purchase purchase, OnConsumeFinishedListener listener) { if (isDisposed()) { if (listener != null) listener.onConsumeFinished(null, new IabResult(IABHELPER_DISPOSED)); return; } checkSetupDone("consume"); consumeAsyncInternal(Arrays.asList(purchase), listener, null); } IabHelper(Context ctx, String base64PublicKey);  IabHelper(Context ctx, SignatureValidator validator); void startSetup(final OnIabSetupFinishedListener listener); void dispose(); void launchPurchaseFlow(final Activity activity,
                                   final String sku,
                                   final ItemType itemType,
                                   final int requestCode,
                                   final OnIabPurchaseFinishedListener listener,
                                   final String developerPayload); boolean handleActivityResult(int requestCode, int intentResultCode, Intent intent); Inventory queryInventory(boolean querySkuDetails,
                                    List<String> moreItemSkus,
                                    List<String> moreSubsSkus); void queryInventoryAsync(final boolean querySkuDetails,
                                    final List<String> moreSkus,
                                    final List<String> moreSubSkus,
                                    final QueryInventoryFinishedListener listener); void queryInventoryAsync(final QueryInventoryFinishedListener listener); void consume(Purchase purchase); void consumeAsync(Purchase purchase, OnConsumeFinishedListener listener); void consumeAsync(List<Purchase> purchases, OnConsumeMultiFinishedListener listener); boolean subscriptionsSupported(); void enableDebugLogging(boolean enable, String tag); void enableDebugLogging(boolean enable);  }### Answer:
@Test public void shouldConsumeAsyncSinglePurchase() throws Exception { shouldStartSetup_SuccessCase(); Purchase purchase = mock(Purchase.class); when(purchase.getToken()).thenReturn("foo"); when(purchase.getItemType()).thenReturn(INAPP); OnConsumeFinishedListener listener = mock(OnConsumeFinishedListener.class); when(service.consumePurchase(API_VERSION, Robolectric.application.getPackageName(), "foo")).thenReturn(OK.code); helper.consumeAsync(purchase, listener); verify(listener).onConsumeFinished(purchase, new IabResult(OK)); }
@Test public void shouldConsumeAsyncMultiplePurchase() throws Exception { shouldStartSetup_SuccessCase(); Purchase p1 = mock(Purchase.class); when(p1.getToken()).thenReturn("foo"); when(p1.getItemType()).thenReturn(INAPP); Purchase p2 = mock(Purchase.class); when(p2.getToken()).thenReturn("bar"); when(p2.getItemType()).thenReturn(INAPP); List<Purchase> purchases = new ArrayList<Purchase>(); purchases.add(p1); purchases.add(p2); OnConsumeMultiFinishedListener listener = mock(OnConsumeMultiFinishedListener.class); when(service.consumePurchase(API_VERSION, Robolectric.application.getPackageName(), "foo")).thenReturn(OK.code); when(service.consumePurchase(API_VERSION, Robolectric.application.getPackageName(), "bar")).thenReturn(ERROR.code); helper.consumeAsync(purchases, listener); List<IabResult> results = new ArrayList<IabResult>(); results.add(new IabResult(OK)); results.add(new IabResult(ERROR)); verify(listener).onConsumeMultiFinished(purchases, results); }