InAppBillingV3Vendor implements Vendor { @Override public void initialize(Context context, InitializationListener listener) { if (context == null || listener == null) { throw new IllegalArgumentException("Context or initialization listener is null"); } initializationListener = listener; if (available()) { listener.initialized(); return; } log("Initializing In-App billing v3..."); available = api.initialize(context, this, lifecycleListener, logger); if (!available) { initializationListener.unavailable(); } } InAppBillingV3Vendor();  InAppBillingV3Vendor(String publicKey64);  InAppBillingV3Vendor(AbstractInAppBillingV3API api);  InAppBillingV3Vendor(AbstractInAppBillingV3API api, @Nullable String publicKey64); @Override String id(); @Override void initialize(Context context, InitializationListener listener); @Override void dispose(Context context); @Override boolean available(); @Override boolean canPurchase(Product product); @Override void purchase(Activity activity, Product product, String developerPayload,
                       PurchaseListener listener); @Override void consume(Context context, Purchase purchase, ConsumeListener listener); @Override void getInventory(Context context, Collection<String> inappSkus, Collection<String> subSkus,
                           InventoryListener listener); @Override void getProductDetails(Context context, String sku, boolean isSubscription,
                                ProductDetailsListener listener); @Override void setLogger(@Nullable Logger logger); @Override boolean onActivityResult(int requestCode, int resultCode, Intent data); @Override Product getProductFrom(JSONObject json); @Override Purchase getPurchaseFrom(JSONObject json);  }
@Test public void passesInitializationWithWorkingApi() throws RemoteException { initialMockApi(true); InAppBillingV3Vendor vendor = new InAppBillingV3Vendor(api, null); vendor.initialize(mock(Context.class), initializationListener); verify(initializationListener, times(1)).initialized(); verify(initializationListener, never()).unavailable(); }
@Test public void failsInitializationWithBrokenApi() throws RemoteException { initialMockApi(false); InAppBillingV3Vendor vendor = new InAppBillingV3Vendor(api, null); vendor.initialize(mock(Context.class), initializationListener); verify(initializationListener, times(1)).unavailable(); verify(initializationListener, never()).initialized(); }