예제 #1
0
 @Test
 public void newWithout() {
   ImmutableBag<String> bag = this.newBag();
   ImmutableBag<String> newBag = bag.newWithout("1");
   Assert.assertNotEquals(bag, newBag);
   Assert.assertEquals(bag.size() - 1, newBag.size());
   Assert.assertEquals(bag.sizeDistinct() - 1, newBag.sizeDistinct());
   ImmutableBag<String> newBag2 = bag.newWithout("0");
   Assert.assertEquals(bag, newBag2);
   Assert.assertEquals(bag.size(), newBag2.size());
   Assert.assertEquals(bag.sizeDistinct(), newBag2.sizeDistinct());
 }
 @Test
 @Override
 public void newWith() {
   ImmutableBag<String> bag = this.newBag();
   ImmutableBag<String> newBag = bag.newWith("1");
   Assert.assertNotEquals(bag, newBag);
   Assert.assertEquals(newBag.size(), bag.size() + 1);
   ImmutableBag<String> newBag2 = bag.newWith("5");
   Assert.assertNotEquals(bag, newBag2);
   Assert.assertEquals(newBag2.size(), bag.size() + 1);
   Assert.assertEquals(1, newBag2.sizeDistinct());
 }