GroupFilterProcessor extends FilterProcessor { @Override public boolean test(final LazyElementCell elementCell) { final String group = elementCell.getGroup(); return view.isEntity(group) || view.isEdge(group); } GroupFilterProcessor(final View view); @Override boolean test(final LazyElementCell elementCell); View getView();  }
@Test public void shouldFilterOutEntityNotInView() throws OperationException, SerialisationException { final GroupFilterProcessor processor = new GroupFilterProcessor(VIEW); final boolean result = processor.test(CellUtil.getLazyCell(new Entity(TestGroups.ENTITY, "vertexI"), serialisation)); assertFalse(result); }
@Test public void shouldNotFilterOutEntityInView() throws OperationException, SerialisationException { final GroupFilterProcessor processor = new GroupFilterProcessor(VIEW); final boolean result = processor.test(CellUtil.getLazyCell(new Entity(TestGroups.ENTITY_2, "vertexI"), serialisation)); assertTrue(result); }
@Test public void shouldFilterOutEdgeNotInView() throws OperationException, SerialisationException { final GroupFilterProcessor processor = new GroupFilterProcessor(VIEW); final boolean result = processor.test(CellUtil.getLazyCell( new Edge.Builder() .group(TestGroups.EDGE) .source("A") .dest("B") .directed(true) .build(), serialisation)); assertFalse(result); }
@Test public void shouldNotFilterOutEdgeInView() throws OperationException, SerialisationException { final GroupFilterProcessor processor = new GroupFilterProcessor(VIEW); final boolean result = processor.test(CellUtil.getLazyCell( new Edge.Builder() .group(TestGroups.EDGE_2) .source("A") .dest("B") .directed(true) .build(), serialisation)); assertTrue(result); }