@Test
    void testMultilevelCollapsing() {
        CompositeItem root = new AndItem();
        CompositeItem l1 = new AndItem();
        CompositeItem l2 = new AndItem();
        CompositeItem l3 = new AndItem();

        root.addItem(l1);

        l1.addItem(new WordItem("l1i1"));
        l1.addItem(l2);

        l2.addItem(new WordItem("l2i1"));
        l2.addItem(l3);
        l2.addItem(new WordItem("l2i2"));

        l3.addItem(new WordItem("l3i1"));
        l3.addItem(new WordItem("l3i2"));

        assertCanonicalized("AND l1i1 l2i1 l3i1 l3i2 l2i2", null, root);
    }
Multiple levels of the same AND/OR should collapse
container-search/src/test/java/com/yahoo/prelude/query/test/QueryCanonicalizerTestCase.java