@Test
public void testStatsTrendActionWithNesting() throws FoxtrotException {

    StatsTrendRequest request = new StatsTrendRequest();
    request.setTable(TestUtils.TEST_TABLE_NAME);
    request.setTimestamp("_timestamp");
    request.setField("battery");
    request.setNesting(Lists.newArrayList("os"));
    BetweenFilter betweenFilter = new BetweenFilter();
    betweenFilter.setFrom(1L);
    betweenFilter.setTo(System.currentTimeMillis());
    betweenFilter.setTemporal(true);
    betweenFilter.setField("_timestamp");
    request.setFilters(Collections.<Filter>singletonList(betweenFilter));
    StatsTrendResponse statsTrendResponse = StatsTrendResponse.class.cast(getQueryExecutor().execute(request));
    assertNotNull(statsTrendResponse);
    assertNull(statsTrendResponse.getResult());
    assertNotNull(statsTrendResponse.getBuckets());
    assertEquals(3, statsTrendResponse.getBuckets()
            .size());
}