Exemple #1
0
  @Override
  @Test
  public void reject() {
    MutableMap<String, String> map = this.classUnderTest();

    MutableMap<String, String> empty = map.filterNot(Predicates2.alwaysTrue());
    Verify.assertInstanceOf(EmptyMap.class, empty);

    MutableMap<String, String> full = map.filterNot(Predicates2.alwaysFalse());
    Verify.assertInstanceOf(SingletonMap.class, full);
    Assert.assertEquals(map, full);
  }
 @Test
 public void without() {
   MutableList<Integer> list = new SextupletonList<Integer>(1, 2, 3, 2, 3, 4);
   Assert.assertSame(list, list.without(9));
   list = list.without(2);
   Verify.assertListsEqual(FastList.newListWith(1, 3, 2, 3, 4), list);
   Verify.assertInstanceOf(QuintupletonList.class, list);
 }
Exemple #3
0
 @Override
 public void withoutAllKeys() {
   MutableMap<Integer, String> map = new SingletonMap<Integer, String>(1, "A");
   MutableMap<Integer, String> mapWithout = map.withoutAllKeys(FastList.newListWith(2, 3));
   Assert.assertSame(map, mapWithout);
   mapWithout = map.withoutAllKeys(FastList.newListWith(1, 2));
   Verify.assertMapsEqual(UnifiedMap.newMap(), mapWithout);
   Verify.assertInstanceOf(EmptyMap.class, mapWithout);
 }
Exemple #4
0
 @Override
 public void withoutKey() {
   MutableMap<Integer, String> map = new SingletonMap<Integer, String>(1, "A");
   MutableMap<Integer, String> mapWithout = map.withoutKey(2);
   Assert.assertSame(map, mapWithout);
   mapWithout = map.withoutKey(1);
   Verify.assertMapsEqual(UnifiedMap.newMap(), mapWithout);
   Verify.assertInstanceOf(EmptyMap.class, mapWithout);
 }
Exemple #5
0
  @Override
  public void withKeyValue() {
    MutableMap<Integer, String> map1 =
        new SingletonMap<Integer, String>(1, "A").withKeyValue(2, "B");
    Verify.assertMapsEqual(UnifiedMap.newWithKeysValues(1, "A", 2, "B"), map1);
    Verify.assertInstanceOf(DoubletonMap.class, map1);

    MutableMap<Integer, String> map2 = new SingletonMap<Integer, String>(1, "A");
    MutableMap<Integer, String> map2with = map2.withKeyValue(1, "AA");
    Verify.assertMapsEqual(UnifiedMap.newWithKeysValues(1, "AA"), map2with);
    Assert.assertSame(map2, map2with);
  }
 @Test
 public void testClone() {
   MutableList<String> growableList = this.list.clone();
   Verify.assertEqualsAndHashCode(this.list, growableList);
   Verify.assertInstanceOf(SextupletonList.class, growableList);
 }