/* * ************************************************************************************* * Copyright (C) 2008 EsperTech, Inc. All rights reserved. * * http://esper.codehaus.org * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * * ************************************************************************************* */ package com.espertech.esper.epl.expression; import com.espertech.esper.support.epl.SupportExprNode; import com.espertech.esper.support.epl.SupportExprNodeFactory; public class TestExprMedianNode extends TestExprAggregateNodeAdapter { public void setUp() throws Exception { super.validatedNodeToTest = makeNode(5, Integer.class); } public void testGetType() throws Exception { assertEquals(Double.class, validatedNodeToTest.getType()); } public void testToExpressionString() throws Exception { assertEquals("median(5)", validatedNodeToTest.toExpressionString()); } public void testEqualsNode() throws Exception { assertTrue(validatedNodeToTest.equalsNode(validatedNodeToTest)); assertFalse(validatedNodeToTest.equalsNode(new ExprSumNode(false, false))); } private ExprMedianNode makeNode(Object value, Class type) throws Exception { ExprMedianNode medianNode = new ExprMedianNode(false, false); medianNode.addChildNode(new SupportExprNode(value, type)); SupportExprNodeFactory.validate3Stream(medianNode); return medianNode; } }