Product implements Parcelable { public JSONObject toJson() throws JSONException { final JSONObject object = new JSONObject(); object.put(KEY_VENDOR_ID, vendorId()); object.put(KEY_NAME, name()); object.put(KEY_SKU, sku()); object.put(KEY_PRICE, price()); object.put(KEY_CURRENCY, currency()); object.put(KEY_DESCRIPTION, description()); object.put(KEY_IS_SUB, isSubscription()); object.put(KEY_MICRO_PRICE, microsPrice()); return object; }  abstract String vendorId(); abstract String sku(); abstract String price(); abstract String currency(); abstract String name(); abstract String description(); abstract boolean isSubscription(); abstract long microsPrice(); static Product create(String json); static Product create(JSONObject json); static Product create(String vendorId,
                               String sku,
                               String price,
                               String currency,
                               String name,
                               String description,
                               boolean isSubscription,
                               long microsPrice); JSONObject toJson(); String toJsonString(); static final String KEY_VENDOR_ID; static final String KEY_SKU; static final String KEY_PRICE; static final String KEY_CURRENCY; static final String KEY_NAME; static final String KEY_DESCRIPTION; static final String KEY_IS_SUB; static final String KEY_MICRO_PRICE; }
@Test public void serializesToJson() throws JSONException { assertJsonHasProperties(product.toJson(), product); }