@Test public void fromJsonString_backToJson_createsIdenticalElement() { try { JSONObject rawConversion = new JSONObject(EXAMPLE_JSON_ADDRESS); assertJsonEquals(rawConversion, mAddress.toJson()); } catch (JSONException jsonException) { fail("Test Data failure: " + jsonException.getLocalizedMessage()); } }
@NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_CITY, mCity); putStringIfNotNull(jsonObject, FIELD_COUNTRY, mCountry); putStringIfNotNull(jsonObject, FIELD_LINE_1, mLine1); putStringIfNotNull(jsonObject, FIELD_LINE_2, mLine2); putStringIfNotNull(jsonObject, FIELD_POSTAL_CODE, mPostalCode); putStringIfNotNull(jsonObject, FIELD_STATE, mState); return jsonObject; }
Address extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_CITY, mCity); putStringIfNotNull(jsonObject, FIELD_COUNTRY, mCountry); putStringIfNotNull(jsonObject, FIELD_LINE_1, mLine1); putStringIfNotNull(jsonObject, FIELD_LINE_2, mLine2); putStringIfNotNull(jsonObject, FIELD_POSTAL_CODE, mPostalCode); putStringIfNotNull(jsonObject, FIELD_STATE, mState); return jsonObject; } }
Address extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_CITY, mCity); putStringIfNotNull(jsonObject, FIELD_COUNTRY, mCountry); putStringIfNotNull(jsonObject, FIELD_LINE_1, mLine1); putStringIfNotNull(jsonObject, FIELD_LINE_2, mLine2); putStringIfNotNull(jsonObject, FIELD_POSTAL_CODE, mPostalCode); putStringIfNotNull(jsonObject, FIELD_STATE, mState); return jsonObject; } Address(
            String city,
            String country,
            String line1,
            String line2,
            String postalCode,
            String state);   Address(Builder addressBuilder); protected  Address(Parcel in); }
Address extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_CITY, mCity); putStringIfNotNull(jsonObject, FIELD_COUNTRY, mCountry); putStringIfNotNull(jsonObject, FIELD_LINE_1, mLine1); putStringIfNotNull(jsonObject, FIELD_LINE_2, mLine2); putStringIfNotNull(jsonObject, FIELD_POSTAL_CODE, mPostalCode); putStringIfNotNull(jsonObject, FIELD_STATE, mState); return jsonObject; } Address(
            String city,
            String country,
            String line1,
            String line2,
            String postalCode,
            String state);   Address(Builder addressBuilder); protected  Address(Parcel in); @Nullable String getCity(); @Deprecated void setCity(String city); @Nullable String getCountry(); @Deprecated void setCountry(String country); @Nullable String getLine1(); @Deprecated void setLine1(String line1); @Nullable String getLine2(); @Deprecated void setLine2(String line2); @Nullable String getPostalCode(); @Deprecated void setPostalCode(String postalCode); @Nullable String getState(); @Deprecated void setState(String state); @NonNull @Override Map<String, Object> toMap(); @NonNull @Override JSONObject toJson(); @Nullable static Address fromString(@Nullable String jsonString); @Nullable static Address fromJson(@Nullable JSONObject jsonObject); @Override void writeToParcel(Parcel out, int flags); @Override int describeContents(); }
Address extends StripeJsonModel implements Parcelable { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_CITY, mCity); putStringIfNotNull(jsonObject, FIELD_COUNTRY, mCountry); putStringIfNotNull(jsonObject, FIELD_LINE_1, mLine1); putStringIfNotNull(jsonObject, FIELD_LINE_2, mLine2); putStringIfNotNull(jsonObject, FIELD_POSTAL_CODE, mPostalCode); putStringIfNotNull(jsonObject, FIELD_STATE, mState); return jsonObject; } Address(
            String city,
            String country,
            String line1,
            String line2,
            String postalCode,
            String state);   Address(Builder addressBuilder); protected  Address(Parcel in); @Nullable String getCity(); @Deprecated void setCity(String city); @Nullable String getCountry(); @Deprecated void setCountry(String country); @Nullable String getLine1(); @Deprecated void setLine1(String line1); @Nullable String getLine2(); @Deprecated void setLine2(String line2); @Nullable String getPostalCode(); @Deprecated void setPostalCode(String postalCode); @Nullable String getState(); @Deprecated void setState(String state); @NonNull @Override Map<String, Object> toMap(); @NonNull @Override JSONObject toJson(); @Nullable static Address fromString(@Nullable String jsonString); @Nullable static Address fromJson(@Nullable JSONObject jsonObject); @Override void writeToParcel(Parcel out, int flags); @Override int describeContents(); static final Parcelable.Creator<Address> CREATOR; }