@Test
    void testCollapsingWithMultipleFieldsAndMultipleCollapseSizeSources() {
        // Set up
        Map<Searcher, Searcher> chained = new HashMap<>();
        FieldCollapsingSearcher collapse = new FieldCollapsingSearcher();
        DocumentSourceSearcher docsource = new DocumentSourceSearcher();
        chained.put(collapse, docsource);

        Query q = new Query("?query=test_collapse");
        Result r = new Result(q);
        r.hits().add(createHit("http://acme.org/a.html", 10, 1, 1));
        r.hits().add(createHit("http://acme.org/b.html", 9, 1, 0));
        r.hits().add(createHit("http://acme.org/c.html", 9, 0, 1));
        r.hits().add(createHit("http://acme.org/d.html", 8, 1, 0));
        r.hits().add(createHit("http://acme.org/3.html", 8, 1, 0));
        r.setTotalHitCount(5);
        docsource.addResult(q, r);

        // Test collapsing
        // collapsesize 10 overwrites the default for amid & bmid
        // collapsize.bmid overwrites the collapsesize for bmid again
        q = new Query("?query=test_collapse&collapsesize=10&collapsefield=amid,bmid&collapsesize.bmid=2");
        r = doSearch(collapse, q, 0, 5, chained);

        assertEquals(4, r.getHitCount());
        assertEquals(1, docsource.getQueryCount());
        assertHit("http://acme.org/a.html", 10, 1, 1, r.hits().get(0));
        assertHit("http://acme.org/b.html", 9, 1, 0, r.hits().get(1));
        assertHit("http://acme.org/c.html", 9, 0, 1, r.hits().get(2));
        assertHit("http://acme.org/d.html", 8, 1, 0, r.hits().get(3));
    }
Tests that using different collapse sizes for different fields works,
test that the different ways to configure collapse size have the correct precedence
container-search/src/test/java/com/yahoo/prelude/searcher/test/FieldCollapsingSearcherTestCase.java