class DefaultVertexTraversal extends AbstractVertexTraversal implements VertexTraversal {

    @Override
    public <T> VertexTraversal filter(Predicate<T> predicate) {
        requireNonNull(predicate, "predicate is required");

        Predicate<Traverser<Vertex>> p = v -> predicate.test(converter.toEntity(v.get()));
        return new DefaultVertexTraversal(supplier, flow.andThen(g -> g.filter(p)), converter);
    }

}

class DefaultVertexTraversalTest extends AbstractVertexTraversal {

    @Test
    public void shouldReturnErrorWhenPredicateIsNull() {

        assertThrows(NullPointerException.class, () -> graphTemplate.getTraversalVertex().filter(null));
    }

}