PiiVisitor implements Visitor<T> { @Override public void onVisit(Schema schema, Collection<String> breadcrumb) { if (PII.equalsIgnoreCase(schema.getProp(SENSITIVITY))) { throw new InvalidPiiAnnotationException(breadcrumb); } }  @Override void onVisit(Schema schema, Collection<String> breadcrumb); @Override void onVisit(Field field, Collection<String> breadcrumb); @Override T getResult(); static final String SENSITIVITY; static final String PII; }
@Test public void schemaWithPii() throws Exception { Schema schema = SchemaBuilder.builder().stringBuilder().prop(SENSITIVITY, PII).endString(); try { underTest.onVisit(schema, breadcrumb); fail(); } catch (InvalidPiiAnnotationException e) { assertThat(e.getPath(), is("/a/b")); } }
@Test public void schemaWithoutPii() throws Exception { Schema schema = SchemaBuilder.builder().stringType(); underTest.onVisit(schema, breadcrumb); }