@Test public void partition() { ImmutableCollection<Integer> integers = this.classUnderTest(); PartitionImmutableCollection<Integer> partition = integers.partition(IntegerPredicates.isOdd()); Assert.assertEquals(integers.select(IntegerPredicates.isOdd()), partition.getSelected()); Assert.assertEquals(integers.select(IntegerPredicates.isEven()), partition.getRejected()); }
@Test public void partition_value() { ImmutableMap<String, Integer> map = this.newMapWithKeysValues("1", 1, "2", 2, "3", 3, "4", 4); PartitionImmutableCollection<Integer> partition = map.partition(IntegerPredicates.isEven()); Assert.assertEquals(this.expectSelect(map.size()), partition.getSelected().toSet()); Assert.assertEquals(this.expectReject(map.size()), partition.getRejected().toSet()); }