use of io.cucumber.messages.internal.com.fasterxml.jackson.databind.node.ObjectNode in project cucumber-jvm by cucumber.
the class AComparableMessage method aComparableValue.
@SuppressWarnings("unchecked")
private static Matcher<?> aComparableValue(Object value, int depth) {
if (value instanceof ObjectNode) {
JsonNode message = (JsonNode) value;
return new AComparableMessage(message, depth);
}
if (value instanceof ArrayNode) {
ArrayNode values = (ArrayNode) value;
Spliterator<JsonNode> spliterator = spliteratorUnknownSize(values.iterator(), 0);
List<Matcher<? super Object>> allComparableValues = stream(spliterator, false).map(o -> aComparableValue(o, depth)).map(o -> (Matcher<? super Object>) o).collect(Collectors.toList());
return contains(allComparableValues);
}
if (value instanceof TextNode || value instanceof NumericNode || value instanceof BooleanNode) {
return CoreMatchers.is(value);
}
throw new IllegalArgumentException("Unsupported type " + value.getClass() + ": " + value);
}
Aggregations