@Override public List<JsonKey> getKeys() { return wrapped.getKeys(); }
@Override public List<JsonKey> getKeys() { return wrapped.getKeys(); }
@Override public List<JsonKey> getKeys() { return wrapped.getKeys(); }
@Override public List<JsonKey> getKeys() { return wrapped.getKeys(); }
private static void handleObject(final String path, final JsonValue value, final List<Document> flatAttributes) { final JsonObject jsonObject = value.asObject(); jsonObject.getKeys().forEach(key -> { final String newPath = path + PersistenceConstants.SLASH + key; final JsonValue innerValue = jsonObject.getValue(key).orElse(null); toFlatAttributesList(newPath, innerValue, flatAttributes); }); }
private static void handleObject(final String path, final JsonValue value, final List<Document> flatAttributes) { final JsonObject jsonObject = value.asObject(); jsonObject.getKeys().forEach(key -> { final String newPath = path + PersistenceConstants.SLASH + key; final JsonValue innerValue = jsonObject.getValue(key).orElse(null); toFlatAttributesList(newPath, innerValue, flatAttributes); }); }
private void addInternalAttributes(final String path, final JsonValue jsonValue) { if ((jsonValue == null) || jsonValue.isNull()) { attributeInternally(path, null); } else if (jsonValue.isString()) { attributeInternally(path, jsonValue.asString()); } else if (jsonValue.isBoolean()) { attributeInternally(path, jsonValue.asBoolean()); } else if (jsonValue.isNumber()) { addNumberAttribute(path, jsonValue); } else if (jsonValue.isObject()) { jsonValue.asObject().getKeys().forEach(key -> // addInternalAttributes(path + PersistenceConstants.SLASH + key, jsonValue.asObject().getValue(key).orElse(null))); } }
private void addInternalAttributes(final String path, final JsonValue jsonValue) { if (jsonValue == null || jsonValue.isNull()) { attributeInternally(path, null); } else if (jsonValue.isString()) { attributeInternally(path, jsonValue.asString()); } else if (jsonValue.isBoolean()) { attributeInternally(path, jsonValue.asBoolean()); } else if (jsonValue.isNumber()) { addNumberAttribute(path, jsonValue); } else if (jsonValue.isObject()) { jsonValue.asObject().getKeys().forEach(key -> // addInternalAttributes(path + PersistenceConstants.SLASH + key, jsonValue.asObject().getValue(key).orElse(null))); } }
private void addInternalFeatures(final String path, final JsonValue jsonValue, final String featureId) { if ((jsonValue == null) || jsonValue.isNull()) { featureInternally(path, null, featureId); } else if (jsonValue.isString()) { featureInternally(path, jsonValue.asString(), featureId); } else if (jsonValue.isBoolean()) { featureInternally(path, jsonValue.asBoolean(), featureId); } else if (jsonValue.isNumber()) { addNumberFeature(path, jsonValue, featureId); } else if (jsonValue.isObject()) { jsonValue.asObject().getKeys().forEach(name -> // addInternalFeatures(path + "/" + name, jsonValue.asObject().getValue(name).orElse(null), featureId)); } }
private void addInternalFeatures(final String path, final JsonValue jsonValue, final String featureId) { if ((jsonValue == null) || jsonValue.isNull()) { featureInternally(path, null, featureId); } else if (jsonValue.isString()) { featureInternally(path, jsonValue.asString(), featureId); } else if (jsonValue.isBoolean()) { featureInternally(path, jsonValue.asBoolean(), featureId); } else if (jsonValue.isNumber()) { addNumberFeature(path, jsonValue, featureId); } else if (jsonValue.isObject()) { jsonValue.asObject().getKeys().forEach(name -> // addInternalFeatures(path + "/" + name, jsonValue.asObject().getValue(name).orElse(null), featureId)); } }
/** * Verifies that the actual JSON object contains the expected value for the specified key. * * @param key the key of the expected value. * @param expectedValue the expected value to be associated with {@code key}. * @return this assert to allow method chaining. */ public JsonObjectAssert contains(final JsonKey key, final JsonValue expectedValue) { isNotNull(); final List<JsonKey> actualNames = actual.getKeys(); Assertions.assertThat(actualNames).contains(key) .overridingErrorMessage("Expected JSON object to contain a field with name <%s> but it did not.", key); final Optional<JsonValue> actualValue = actual.getValue(key); assertThat(actualValue) .overridingErrorMessage("Expected JSON object to contain value <%s> for key <%s> but the actual value" + " was <%s>", expectedValue, key, actualValue.orElse(null)) .contains(expectedValue); return this; }