@Test
    void testConstructionAndClone() {
        Query query = new Query();
        query.getSelect().setWhereString("{\"contains\" : [\"default\", \"select\"] }");
        query.getSelect().setGroupingString("[ { \"all\" : { \"group\" : \"time.dayofmonth(a)\", \"each\" : { \"output\" : \"count()\" } } } ]");
        GroupingRequest secondRequest = GroupingRequest.newInstance(query);
        assertEquals("default:select", query.getModel().getQueryTree().toString());
        assertEquals(2, query.getSelect().getGrouping().size());
        assertEquals("all(group(time.dayofmonth(a)) each(output(count())))", query.getSelect().getGrouping().get(0).toString());

        Query clone = query.clone();
        assertEquals(clone.getSelect().getGroupingExpressionString(), query.getSelect().getGroupingExpressionString());
        assertNotSame(query.getSelect(), clone.getSelect());
        assertNotSame(query.getSelect().getGrouping(), clone.getSelect().getGrouping());
        assertNotSame(query.getSelect().getGrouping().get(0), clone.getSelect().getGrouping().get(0));
        assertNotSame(query.getSelect().getGrouping().get(1), clone.getSelect().getGrouping().get(1));
        assertEquals(query.getSelect().getWhereString(), clone.getSelect().getWhereString());
        assertEquals(query.getSelect().getGroupingString(), clone.getSelect().getGroupingString());
        assertEquals(query.getSelect().getGrouping().get(0).toString(), clone.getSelect().getGrouping().get(0).toString());
        assertEquals(query.getSelect().getGrouping().get(1).toString(), clone.getSelect().getGrouping().get(1).toString());
    }
Tests Query.Select

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