### Question:
Skus { @Nonnull static Skus fromBundle(@Nonnull Bundle bundle, @Nonnull String product) throws RequestException { final List<String> list = extractList(bundle); final List<Sku> skus = new ArrayList<>(list.size()); for (String response : list) { try { skus.add(Sku.fromJson(response, product)); } catch (JSONException e) { throw new RequestException(e); } } return new Skus(product, skus); } Skus(@Nonnull String product, @Nonnull List<Sku> list); @Nullable Sku getSku(@Nonnull String sku); boolean hasSku(@Nonnull String sku); @Nonnull
    final String product; @Nonnull
    final List<Sku> list; }### Answer:
@Test public void testShouldReadNullList() throws Exception { final Skus skus = Skus.fromBundle(new Bundle(), "test"); assertTrue(skus.list.isEmpty()); }
@Test public void testShouldReadEmptyList() throws Exception { final Bundle bundle = new Bundle(); bundle.putStringArrayList(Skus.BUNDLE_LIST, new ArrayList<String>()); final Skus skus = Skus.fromBundle(bundle, "test"); assertTrue(skus.list.isEmpty()); }
@Test public void testShouldHaveCorrectProduct() throws Exception { final Skus skus = Skus.fromBundle(new Bundle(), "test"); assertEquals("test", skus.product); }
@Test public void testShouldReadSkus() throws Exception { final ArrayList<String> list = new ArrayList<String>(); list.add(SkuTest.newInAppJson("1")); list.add(SkuTest.newInAppJson("2")); list.add(SkuTest.newSubscriptionJson("3")); list.add(SkuTest.newSubscriptionJson("4")); final Bundle bundle = new Bundle(); bundle.putStringArrayList(Skus.BUNDLE_LIST, list); final Skus skus = Skus.fromBundle(bundle, "dummy"); assertEquals(4, skus.list.size()); SkuTest.verifySku(skus.list.get(0), "1"); SkuTest.verifySku(skus.list.get(3), "4"); }