@Test(expected = InvalidKeyPathException.class) public void rootNotARecord() throws InvalidKeyPathException { Path path = KeyPathParser.parse("$[\"a\"]"); Schema schema = SchemaBuilder.array().items(Schema.create(Type.STRING)); try { new KeyPathValidator(path, schema).validate(); } catch (Exception e) { assertThat(e.getMessage(), is("Element '$' not a traversable type (found 'ARRAY'), in path: $[\"a\"]")); throw e; } }
public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); }
KeyPathValidator { public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); } }
KeyPathValidator { public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); } KeyPathValidator(Path path, Schema schema); }
KeyPathValidator { public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); } KeyPathValidator(Path path, Schema schema); void validate(); }
KeyPathValidator { public void validate() throws InvalidKeyPathException { List<Element> elements = path.elements(); validateElement(elements, rootSchema, elements.get(0).toString()); } KeyPathValidator(Path path, Schema schema); void validate();  }