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

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