@Test public void fromJsonString_backToJson_createsIdenticalElement() { try { JSONObject rawConversion = new JSONObject(EXAMPLE_JSON_REDIRECT); assertJsonEquals(rawConversion, mSourceRedirect.toJson()); } catch (JSONException jsonException) { fail("Test Data failure: " + jsonException.getLocalizedMessage()); } }
@NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_RETURN_URL, mReturnUrl); putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); putStringIfNotNull(jsonObject, FIELD_URL, mUrl); return jsonObject; }
SourceRedirect extends StripeJsonModel { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_RETURN_URL, mReturnUrl); putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); putStringIfNotNull(jsonObject, FIELD_URL, mUrl); return jsonObject; } }
SourceRedirect extends StripeJsonModel { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_RETURN_URL, mReturnUrl); putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); putStringIfNotNull(jsonObject, FIELD_URL, mUrl); return jsonObject; } SourceRedirect(String returnUrl, @Status String status, String url); }
SourceRedirect extends StripeJsonModel { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_RETURN_URL, mReturnUrl); putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); putStringIfNotNull(jsonObject, FIELD_URL, mUrl); return jsonObject; } SourceRedirect(String returnUrl, @Status String status, String url); String getReturnUrl(); void setReturnUrl(String returnUrl); @Status String getStatus(); void setStatus(@Status String status); String getUrl(); void setUrl(String url); @NonNull @Override Map<String, Object> toMap(); @NonNull @Override JSONObject toJson(); @Nullable static SourceRedirect fromString(@Nullable String jsonString); @Nullable static SourceRedirect fromJson(@Nullable JSONObject jsonObject); }
SourceRedirect extends StripeJsonModel { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); putStringIfNotNull(jsonObject, FIELD_RETURN_URL, mReturnUrl); putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); putStringIfNotNull(jsonObject, FIELD_URL, mUrl); return jsonObject; } SourceRedirect(String returnUrl, @Status String status, String url); String getReturnUrl(); void setReturnUrl(String returnUrl); @Status String getStatus(); void setStatus(@Status String status); String getUrl(); void setUrl(String url); @NonNull @Override Map<String, Object> toMap(); @NonNull @Override JSONObject toJson(); @Nullable static SourceRedirect fromString(@Nullable String jsonString); @Nullable static SourceRedirect fromJson(@Nullable JSONObject jsonObject); static final String PENDING; static final String SUCCEEDED; static final String FAILED; }