@Test
    void testProgrammaticAssignment() {
        Query query = new Query();
        query.getSelect().setGroupingString("[ { \"all\" : { \"group\" : \"time.year(a)\", \"each\" : { \"output\" : \"count()\" } } } ]");
        assertEquals(1, query.getSelect().getGrouping().size());
        assertEquals("all(group(time.year(a)) each(output(count())))", query.getSelect().getGrouping().get(0).getRootOperation().toString());

        // Setting from string resets the grouping expression
        query.getSelect().setGroupingString("[ { \"all\" : { \"group\" : \"time.dayofmonth(a)\", \"each\" : { \"output\" : \"count()\" } } } ]");
        assertEquals(1, query.getSelect().getGrouping().size());
        assertEquals("all(group(time.dayofmonth(a)) each(output(count())))", query.getSelect().getGrouping().get(0).getRootOperation().toString());
    }
Tests Query.Select

@author henrhoi
@author bratseth
container-search/src/test/java/com/yahoo/select/SelectTestCase.java