/** * Gets the property value which is referred by the given JSON Pointer. * * @param pointer defines the hierarchical path to the property value to be returned. * @return the value of the property which is referred by {@code pointer}. * @throws NullPointerException if {@code pointer} is {@code null}. */ default Optional<JsonValue> getProperty(final CharSequence pointer) { return getProperty(JsonPointer.of(pointer)); }
/** * Gets the property value which is referred by the given JSON Pointer. * * @param pointer defines the hierarchical path to the property value to be returned. * @return the value of the property which is referred by {@code pointer}. * @throws NullPointerException if {@code pointer} is {@code null}. */ default Optional<JsonValue> getProperty(final CharSequence pointer) { return getProperty(JsonPointer.of(pointer)); }
@Override public Predicate<Thing> visitFeatureIdProperty(final String featureId, final String property) { return thing -> thing.getFeatures() .flatMap(features -> features.getFeature(featureId)) .map(feature -> feature.getProperty(property).isPresent()) .orElse(false); }
@Override public Predicate<Thing> visitFeatureProperty(final String property) { return thing -> thing.getFeatures() .map(features -> features.stream() .anyMatch(feature -> feature.getProperty(property).isPresent()) ) .orElse(false); }
@Override public Predicate<Thing> visitFeatureProperty(final String property) { return thing -> thing.getFeatures() .map(features -> features.stream() .anyMatch(feature -> feature.getProperty(property).isPresent()) ) .orElse(false); }
@Override public Optional<JsonValue> determineETagEntity(final ModifyFeatureProperty command, @Nullable final Thing thing) { return extractFeature(command, getThingOrThrow(thing)).flatMap( feature -> feature.getProperty(command.getPropertyPointer())); } }
@Override public Optional<JsonValue> determineETagEntity(final ModifyFeatureProperty command, @Nullable final Thing thing) { return extractFeature(command, getThingOrThrow(thing)).flatMap( feature -> feature.getProperty(command.getPropertyPointer())); } }
public ThingAssert hasNotFeatureProperty(final String featureId, final JsonPointer propertyPath) { isNotNull(); final boolean isHasFeatureProperty = actual.getFeatures() // .flatMap(features -> features.getFeature(featureId)) // .flatMap(feature -> feature.getProperty(propertyPath)) // .isPresent(); assertThat(isHasFeatureProperty) // .overridingErrorMessage("Expected Thing Feature not to have a property at <%s> but it had.", propertyPath) // .isFalse(); return this; }
public ThingAssert hasFeatureProperty(final String featureId, final JsonPointer propertyPath, final JsonValue expectedValue) { isNotNull(); final JsonValue actualPropertyValue = actual.getFeatures() // .flatMap(features -> features.getFeature(featureId)) // .flatMap(feature -> feature.getProperty(propertyPath)) // .orElse(null); assertThat(actualPropertyValue) // .overridingErrorMessage("Expected Thing Feature property at <%s> to be \n<%s> but it was \n<%s>", propertyPath, expectedValue, actualPropertyValue) // .isEqualTo(expectedValue); return this; }