JsonValue { public VoidMultiplexer canBeSchema(Consumer<JsonValue> consumer) { if (DRAFT_4.equals(this.ls.specVersion())) { return new VoidMultiplexer(JsonObject.class, consumer); } else { return new VoidMultiplexerWithSchemaPredicate(consumer); } } protected  JsonValue(Object obj); VoidMultiplexer canBe(Class<T> expectedType, Consumer<T> consumer); VoidMultiplexer canBeSchema(Consumer<JsonValue> consumer); Multiplexer<R> canBeMappedTo(Class<T> expectedType, Function<T, R> mapper); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); String requireString(); R requireString(Function<String, R> mapper); Boolean requireBoolean(); R requireBoolean(Function<Boolean, R> mapper); JsonObject requireObject(); R requireObject(Function<JsonObject, R> mapper); JsonArray requireArray(); R requireArray(Function<JsonArray, R> mapper); Number requireNumber(); R requireNumber(Function<Number, R> mapper); Integer requireInteger(); R requireInteger(Function<Integer, R> mapper);  }
@Test public void booleanCanBeSchemaIfV6() { Consumer<JsonValue> ifSchema = spy(schemaConsumer()); JsonValue subject = asV6Value(true); subject.canBeSchema(ifSchema).requireAny(); verify(ifSchema).accept(subject); }
@Test public void canBeSchemaWithV6hasProperExceptionMessage() { Consumer<JsonValue> ifSchema = spy(schemaConsumer()); JsonValue subject = asV6Value(42); try { subject.canBeSchema(ifSchema).requireAny(); } catch (SchemaException e) { assertEquals("#: expected type is one of Boolean or JsonObject, found: Integer", e.getMessage()); } verify(ifSchema, never()).accept(subject); }