@Test public void fromJsonString_backToJson_createsIdenticalElement() { try { JSONObject rawConversion = new JSONObject(EXAMPLE_JSON_CODE_VERIFICATION); assertJsonEquals(rawConversion, mCodeVerification.toJson()); } catch (JSONException jsonException) { fail("Test Data failure: " + jsonException.getLocalizedMessage()); } }
@NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); try{ jsonObject.put(FIELD_ATTEMPTS_REMAINING, mAttemptsRemaining); StripeJsonUtils.putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); } catch (JSONException ignored) { } return jsonObject; }
SourceCodeVerification extends StripeJsonModel { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); try{ jsonObject.put(FIELD_ATTEMPTS_REMAINING, mAttemptsRemaining); StripeJsonUtils.putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); } catch (JSONException ignored) { } return jsonObject; } }
SourceCodeVerification extends StripeJsonModel { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); try{ jsonObject.put(FIELD_ATTEMPTS_REMAINING, mAttemptsRemaining); StripeJsonUtils.putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); } catch (JSONException ignored) { } return jsonObject; } SourceCodeVerification(int attemptsRemaining, @Status String status); }
SourceCodeVerification extends StripeJsonModel { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); try{ jsonObject.put(FIELD_ATTEMPTS_REMAINING, mAttemptsRemaining); StripeJsonUtils.putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); } catch (JSONException ignored) { } return jsonObject; } SourceCodeVerification(int attemptsRemaining, @Status String status); int getAttemptsRemaining(); @Status String getStatus(); @NonNull @Override Map<String, Object> toMap(); @NonNull @Override JSONObject toJson(); @Nullable static SourceCodeVerification fromString(@Nullable String jsonString); @Nullable static SourceCodeVerification fromJson(@Nullable JSONObject jsonObject); }
SourceCodeVerification extends StripeJsonModel { @NonNull @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); try{ jsonObject.put(FIELD_ATTEMPTS_REMAINING, mAttemptsRemaining); StripeJsonUtils.putStringIfNotNull(jsonObject, FIELD_STATUS, mStatus); } catch (JSONException ignored) { } return jsonObject; } SourceCodeVerification(int attemptsRemaining, @Status String status); int getAttemptsRemaining(); @Status String getStatus(); @NonNull @Override Map<String, Object> toMap(); @NonNull @Override JSONObject toJson(); @Nullable static SourceCodeVerification fromString(@Nullable String jsonString); @Nullable static SourceCodeVerification fromJson(@Nullable JSONObject jsonObject);  }