@Test(expected = InvalidKeyPathException.class)
public void nestedFail() throws InvalidKeyPathException {

  Path path = KeyPathParser.parse("$[\"a\"].b[\"c\"]");
  Schema schema = SchemaBuilder
      .record("X")
      .fields()
      .name("a")
      .type(SchemaBuilder.record("Y").fields().name("b").type(Schema.create(Type.STRING)).noDefault().endRecord())
      .noDefault()
      .endRecord();
  try {
    new KeyPathValidator(path, schema).validate();
  } catch (Exception e) {
    assertThat(e.getMessage(),
        is("Element '$[\"a\"].b' not a traversable type (found 'STRING'), in path: $[\"a\"].b[\"c\"]"));
    throw e;
  }
}