use of mondrian.olap.Evaluator.SetEvaluator in project mondrian by pentaho.
the class SqlConstraintUtilsTest method makeAggregateExprMember.
private Member makeAggregateExprMember(Evaluator mockEvaluator, List<Member> endMembers) {
Member member = Mockito.mock(Member.class);
Mockito.doReturn(true).when(member).isCalculated();
Member aggregatedMember0 = Mockito.mock(Member.class);
Exp aggregateArg0 = new MemberExpr(aggregatedMember0);
FunDef dummy = Mockito.mock(FunDef.class);
Mockito.doReturn(Syntax.Function).when(dummy).getSyntax();
Mockito.doReturn("dummy").when(dummy).getName();
FunDef funDef = new AggregateFunDef(dummy);
Exp[] args = new Exp[] { aggregateArg0 };
Type returnType = new DecimalType(1, 1);
Exp memberExp = new ResolvedFunCall(funDef, args, returnType);
Mockito.doReturn(memberExp).when(member).getExpression();
SetEvaluator setEvaluator = Mockito.mock(SetEvaluator.class);
Mockito.doReturn(setEvaluator).when(mockEvaluator).getSetEvaluator(aggregateArg0, true);
Mockito.doReturn(new UnaryTupleList(endMembers)).when(setEvaluator).evaluateTupleIterable();
Assert.assertEquals(true, member.isCalculated());
Assert.assertEquals(true, SqlConstraintUtils.isSupportedCalculatedMember(member));
return member;
}
Aggregations