### Question:
IabHelper { int getResponseCodeFromBundle(Bundle bundle) { Object o; if (bundle == null || (o = bundle.get(RESPONSE_CODE)) == null) { logDebug("Bundle with null response code, assuming OK (known issue)"); return OK.code; } else if (o instanceof Integer) return (Integer) o; else if (o instanceof Long) return (int) ((Long) o).longValue(); else { logError("Unexpected type for bundle response code."); logError(o.getClass().getName()); throw new RuntimeException("Unexpected type for bundle response code: " + o.getClass().getName()); } } 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 shouldGetResponseCodeFromBundleEmpty() throws Exception { Bundle b = new Bundle(); assertThat(helper.getResponseCodeFromBundle(b)).isEqualTo(OK.code); }
@Test public void shouldGetResponseCodeFromBundleInt() throws Exception { Bundle b = new Bundle(); b.putInt(RESPONSE_CODE, 20); assertThat(helper.getResponseCodeFromBundle(b)).isEqualTo(20); }
@Test public void shouldGetResponseCodeFromBundleLong() throws Exception { Bundle b = new Bundle(); b.putLong(RESPONSE_CODE, 60L); assertThat(helper.getResponseCodeFromBundle(b)).isEqualTo(60); }
@Test(expected = RuntimeException.class) public void shouldGetResponseCodeFromBundleUnknown() throws Exception { Bundle b = new Bundle(); b.putString(RESPONSE_CODE, "invalid"); helper.getResponseCodeFromBundle(b); }