Aggregate implements Expression { public int hashCode() { return Objects.hashCode(type.getName(), expressions, function); } 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 equalObjectsHaveSameHashCode() { Aggregate<Integer> agg2 = new Aggregate<Integer>(Integer.class, function, Lists.newArrayList(exp1, exp2)); assertEquals(agg.hashCode(), agg2.hashCode()); }
@Test public void hashCodeDoesNotChange() { assertEquals(agg.hashCode(), agg.hashCode()); }
@Test public void hashCodeCanVary() { Aggregate<Integer> agg2 = new Aggregate<Integer>(Integer.class, function, Lists.newArrayList(exp2)); assertNotEquals(agg.hashCode(), agg2.hashCode()); }