@Override
    public Predicate accept(Visitor visitor, IndexRegistry indexes) {
        Predicate[] result = VisitorUtils.acceptVisitor(predicates, visitor, indexes);
        if (result != predicates) {
            //inner predicates were modified by a visitor
            AndPredicate newPredicate = new AndPredicate(result);
            return visitor.visit(newPredicate, indexes);
        }
        return visitor.visit(this, indexes);
    }
@Test
    public void accept_whenEmptyPredicate_thenReturnItself() {
        Visitor mockVisitor = createPassthroughVisitor();
        IndexRegistry mockIndexes = mock(IndexRegistry.class);

        AndPredicate andPredicate = new AndPredicate(new Predicate[0]);
        AndPredicate result = (AndPredicate) andPredicate.accept(mockVisitor, mockIndexes);

        assertThat(result).isSameAs(andPredicate);
    }