@Test
public void testGetQueryWithNestedTransformWithDivide2() {

    long relativeTo = System.currentTimeMillis();
    QueryContext context = QueryUtils.getQueryContext("DIVIDE(SUM(-1h:argus.core:alerts.scheduled:zimsum:1m-sum, -1h:argus.core:alerts.evaluated:zimsum:1m-sum), -1h:argus.core:alerts.scheduled:zimsum:1m-sum)", relativeTo);
    assertEquals(context.getTransform(), Function.DIVIDE);
    assertEquals(context.getConstants().size(), 0);
    assertEquals(context.getChildContexts().size(),2);
    assertNull(context.getExpression());
    QueryContext context1 = context.getChildContexts().get(1);
    assertEquals(context1.getTransform(), null);
    assertNull(context1.getConstants());
    assertEquals(context1.getChildContexts().size(),0);
    assertNotNull(context1.getExpression());
    TSDBQueryExpression expression = context1.getExpression();
    assertEquals(expression.getScope(), "argus.core");
    assertEquals(expression.getMetric(), "alerts.scheduled");
    assertEquals(expression.getAggregator().toString(), "ZIMSUM");
    assertEquals(expression.getDownsampler().toString(), "SUM");
    assertEquals(expression.getDownsamplingPeriod(), new Long(60000));
    assertEquals(expression.getStartTimestamp(),new Long(((relativeTo - 3600*1000)/1000)*1000));
    assertEquals(expression.getEndTimestamp(),new Long(relativeTo));
    QueryContext context2 = context.getChildContexts().get(0);
    assertEquals(context2.getTransform(), Function.SUM);
    assertEquals(context2.getConstants().size(), 0);
    assertEquals(context2.getChildContexts().size(),2);
    assertNull(context2.getExpression());
    TSDBQueryExpression expression1 = context2.getChildContexts().get(0).getExpression();
    assertEquals(expression1.getScope(), "argus.core");
    assertEquals(expression1.getMetric(), "alerts.scheduled");
    assertEquals(expression1.getAggregator().toString(), "ZIMSUM");
    assertEquals(expression1.getDownsampler().toString(), "SUM");
    assertEquals(expression1.getDownsamplingPeriod(), new Long(60000));
    assertEquals(expression1.getStartTimestamp(),new Long(((relativeTo - 3600*1000)/1000)*1000));
    assertEquals(expression1.getEndTimestamp(),new Long(relativeTo));
    TSDBQueryExpression expression2 = context2.getChildContexts().get(1).getExpression();
    assertEquals(expression2.getScope(), "argus.core");
    assertEquals(expression2.getMetric(), "alerts.evaluated");
    assertEquals(expression2.getAggregator().toString(), "ZIMSUM");
    assertEquals(expression2.getDownsampler().toString(), "SUM");
    assertEquals(expression2.getDownsamplingPeriod(), new Long(60000));
    assertEquals(expression2.getStartTimestamp(),new Long(((relativeTo - 3600*1000)/1000)*1000));
    assertEquals(expression2.getEndTimestamp(),new Long(relativeTo));
}