ValidationProcessor extends FilterProcessor { @Override public boolean test(final LazyElementCell elementCell) { return validator.validateWithSchema(elementCell.getElement()); } ValidationProcessor(final Schema schema); @Override boolean test(final LazyElementCell elementCell); Schema getSchema();  }
@Test public void shouldFilterOutInvalidEntity() throws OperationException, SerialisationException { final ValidationProcessor processor = new ValidationProcessor(SCHEMA); assertFalse(processor.test(CellUtil.getLazyCell(new Entity(TestGroups.ENTITY, "invalidVertex"), serialisation))); }
@Test public void shouldNotFilterOutValidEntity() throws OperationException, SerialisationException { final ValidationProcessor processor = new ValidationProcessor(SCHEMA); assertTrue(processor.test(CellUtil.getLazyCell(new Entity(TestGroups.ENTITY, "validVertex"), serialisation))); }
@Test public void shouldFilterOutInvalidEdge() throws OperationException, SerialisationException { final ValidationProcessor processor = new ValidationProcessor(SCHEMA); assertFalse(processor.test(CellUtil.getLazyCell( new Edge.Builder() .group(TestGroups.EDGE) .source("invalidVertex") .dest("dest") .directed(true) .build(), serialisation))); }
@Test public void shouldNotFilterOutValidEdge() throws OperationException, SerialisationException { final ValidationProcessor processor = new ValidationProcessor(SCHEMA); assertTrue(processor.test(CellUtil.getLazyCell( new Edge.Builder() .group(TestGroups.EDGE) .source("validVertex") .dest("dest") .directed(true) .build(), serialisation))); }