@Test
  public void rejectWith_value() {
    ImmutableMap<String, Integer> map = this.newMapWithKeysValues("1", 1, "2", 2, "3", 3, "4", 4);

    switch (map.size()) {
      case 1:
        Verify.assertEmpty(
            map.rejectWith(Predicates2.<Integer>lessThan(), 2, UnifiedSet.<Integer>newSet()));
        break;
      case 2:
        Verify.assertContainsAll(
            map.rejectWith(Predicates2.<Integer>lessThan(), 2, UnifiedSet.<Integer>newSet()), 2);
        break;
      case 3:
        Verify.assertContainsAll(
            map.rejectWith(Predicates2.<Integer>lessThan(), 2, UnifiedSet.<Integer>newSet()), 2, 3);
        break;
      case 4:
        Verify.assertContainsAll(
            map.rejectWith(Predicates2.<Integer>lessThan(), 2, UnifiedSet.<Integer>newSet()),
            2,
            3,
            4);
        break;
      default:
        Verify.assertEmpty(map);
        break;
    }
  }
 @Override
 public void partitionWith() {
   PartitionImmutableBag<String> partition =
       this.newBag().partitionWith(Predicates2.<String>lessThan(), "0");
   Verify.assertIterableEmpty(partition.getSelected());
   Verify.assertIterableEmpty(partition.getRejected());
 }
 @Test
 public void rejectWith() {
   Assert.assertEquals(
       FastList.newListWith(3, 4, 5, 6, 7),
       this.lazyIterable.rejectWith(
           Predicates2.<Integer>lessThan(), 3, FastList.<Integer>newList()));
 }
 @Test
 public void selectWith() {
   Assert.assertEquals(
       FastList.newListWith(1, 2),
       this.lazyIterable.selectWith(
           Predicates2.<Integer>lessThan(), 3, FastList.<Integer>newList()));
 }
Ejemplo n.º 5
0
  @Test
  public void rejectWith() {
    ImmutableBag<String> strings = this.newBag();

    Assert.assertEquals(strings, strings.rejectWith(Predicates2.<String>lessThan(), "0"));
  }