Aggregate implements Expression { public boolean equals(Object o) { return o instanceof Aggregate && compareTo((Aggregate) o) == 0; } Aggregate(Class<T> type,
                   Foldable<T> function,
                   List<Expression> expressions); void visit(ExpressionVisitor visitor); Class<T> typeConstraint(); Iterable<Expression> children(); int compareTo(Expression e); boolean equals(Object o); int hashCode(); final Class<T> type; final Foldable<T> function; final List<Expression> expressions; final int order; }
@Test public void equalsNullIsFalse() { assertFalse(agg.equals(null)); }
@Test public void equalsSelfIsTrue() { assertTrue(agg.equals(agg)); }
@Test public void equalsSameValuesIsTrue() { Aggregate<Integer> agg2 = new Aggregate<Integer>(Integer.class, function, Lists.newArrayList(exp1, exp2)); assertTrue(agg.equals(agg2)); }
@Test public void equalsDifferentTypeIsFalse() { @SuppressWarnings("unchecked") Foldable<String> function2 = mock(Foldable.class); Aggregate<String> agg2 = new Aggregate<String>(String.class, function2, Lists.newArrayList(exp1, exp2)); assertFalse(agg.equals(agg2)); }
@Test public void equalsDifferentFunctionIsFalse() { @SuppressWarnings("unchecked") Foldable<Integer> function2 = mock(Foldable.class); Aggregate<Integer> agg2 = new Aggregate<Integer>(Integer.class, function2, Lists.newArrayList(exp1, exp2)); assertFalse(agg.equals(agg2)); }
@Test public void equalsDifferentExpressionsIsFalse() { Aggregate<Integer> agg2 = new Aggregate<Integer>(Integer.class, function, Lists.newArrayList(exp2)); assertFalse(agg.equals(agg2)); }
@Test public void differentObjectTypesAreNotEqual() { assertFalse(agg.equals(exp1)); }