// you choose between variance(..) and hasVariance(..)
// and noVariance(..) and hasNoVariance(..)
public class GroupsVarianceTest {
private Person mario1 = new Person("Mario", "Fusco", true, "01/01/1999" );
private Person peter = new Person("Peter", "Pan", true, "02/02/1999" );
private Person mario2 = new Person("Mario", "Two", true, "04/04/1999");
@Test
public void oneGroupsRecognizedSuggestingNoVariance() {
assertTrue(hasNoVariance(asList(mario1, mario2), by(on(Person.class).getFirstName())));
}
private boolean hasNoVariance(Iterable<?> iterable, GroupCondition<?>... conditions) {
return variance(iterable, conditions) == 1;
}
private int variance(Iterable<?> iterable, GroupCondition<?>... conditions) {
return group(iterable, conditions).subgroups().size();
}
}
Original issue reported on code.google.com by PaulHamm...@gmail.com on 2 Sep 2010 at 1:15
Original issue reported on code.google.com by
PaulHamm...@gmail.com
on 2 Sep 2010 at 1:15