NotExpression implements IBooleanExpression { @Override public Object evaluate(IEvent theEvent) { Boolean value = (Boolean)innerExpr.evaluate(theEvent); if (value == null) { return null; } return !value; } NotExpression(IExpression innerExpr); @Override Object evaluate(IEvent theEvent); @Override Object evaluate(IEvent[] eventsPerStream); @Override Class< ? > getType(); IExpression getInnerExpr();  }
@Test public void testEvaluateIEvent() throws StreamingException { notExpr = new NotExpression(new ConstExpression(false)); actualResult = notExpr.evaluate(theEvent); Assert.assertEquals(true, actualResult); notExpr = new NotExpression(new ConstExpression(true)); actualResult = notExpr.evaluate(theEvent); Assert.assertEquals(false, actualResult); notExpr = new NotExpression(new ConstExpression(null, Boolean.class)); actualResult = notExpr.evaluate(theEvent); Assert.assertEquals(null, actualResult); }
@Test public void testEvaluateIEventArray() throws StreamingException { notExpr = new NotExpression(new ConstExpression(false)); actualResult = notExpr.evaluate(theEvents); Assert.assertEquals(true, actualResult); notExpr = new NotExpression(new ConstExpression(true)); actualResult = notExpr.evaluate(theEvents); Assert.assertEquals(false, actualResult); notExpr = new NotExpression(new ConstExpression(null, Boolean.class)); actualResult = notExpr.evaluate(theEvents); Assert.assertEquals(null, actualResult); }