use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method addAllIterable.
@Test
public void addAllIterable() {
MutableBooleanCollection collection = this.classUnderTest();
Assert.assertFalse(collection.addAll(this.newMutableCollectionWith()));
Assert.assertTrue(collection.addAll(this.newMutableCollectionWith(false, true, false)));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false, true, false), collection);
Assert.assertTrue(collection.addAll(this.newMutableCollectionWith(true, false, true, false, true)));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false, true, false, true, false, true, false, true), collection);
MutableBooleanCollection emptyCollection = this.newWith();
Assert.assertTrue(emptyCollection.addAll(BooleanArrayList.newListWith(true, false, true, false, true)));
Assert.assertFalse(emptyCollection.addAll(new BooleanArrayList()));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false, true), emptyCollection);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method iterator_throws_on_invocation_of_remove_before_next.
@Test
public void iterator_throws_on_invocation_of_remove_before_next() {
MutableBooleanCollection booleanIterable = this.newWith(true, false);
MutableBooleanIterator iterator = booleanIterable.booleanIterator();
Assert.assertTrue(iterator.hasNext());
Verify.assertThrows(IllegalStateException.class, iterator::remove);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method remove.
@Test
public void remove() {
MutableBooleanCollection collection = this.classUnderTest();
Assert.assertTrue(collection.remove(false));
Assert.assertEquals(this.newMutableCollectionWith(true, true), collection);
Assert.assertFalse(collection.remove(false));
Assert.assertEquals(this.newMutableCollectionWith(true, true), collection);
Assert.assertTrue(collection.remove(true));
Assert.assertEquals(this.newMutableCollectionWith(true), collection);
MutableBooleanCollection collection1 = this.newWith();
Assert.assertFalse(collection1.remove(false));
Assert.assertEquals(this.newMutableCollectionWith(), collection1);
Assert.assertTrue(collection1.add(false));
Assert.assertTrue(collection1.add(false));
Assert.assertTrue(collection1.remove(false));
Assert.assertEquals(this.newMutableCollectionWith(false), collection1);
Assert.assertTrue(collection1.remove(false));
Assert.assertEquals(this.newMutableCollectionWith(), collection1);
MutableBooleanCollection collection2 = this.newWith();
Assert.assertFalse(collection2.remove(true));
Assert.assertEquals(this.newMutableCollectionWith(), collection2);
Assert.assertTrue(collection2.add(true));
Assert.assertTrue(collection2.add(true));
Assert.assertTrue(collection2.remove(true));
Assert.assertEquals(this.newMutableCollectionWith(true), collection2);
Assert.assertTrue(collection2.remove(true));
Assert.assertEquals(this.newMutableCollectionWith(), collection2);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method without.
@Test
public void without() {
MutableBooleanCollection collection = this.newWith(true, false, true, false, true);
Assert.assertEquals(this.newMutableCollectionWith(true, true, false, true), collection.without(false));
Assert.assertEquals(this.newMutableCollectionWith(true, false, true), collection.without(true));
Assert.assertEquals(this.newMutableCollectionWith(true, true), collection.without(false));
Assert.assertEquals(this.newMutableCollectionWith(true), collection.without(true));
Assert.assertEquals(this.newMutableCollectionWith(true), collection.without(false));
Assert.assertEquals(this.newMutableCollectionWith(), collection.without(true));
Assert.assertEquals(this.newMutableCollectionWith(), collection.without(false));
MutableBooleanCollection collection1 = this.newWith(true, false, true, false, true);
Assert.assertSame(collection1, collection1.without(false));
Assert.assertEquals(this.newMutableCollectionWith(true, true, false, true), collection1);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method asSynchronized.
@Test
public void asSynchronized() {
MutableBooleanCollection collection = this.classUnderTest();
Verify.assertInstanceOf(this.newWith(true, false, true).asSynchronized().getClass(), collection.asSynchronized());
Assert.assertEquals(this.newWith(true, false, true).asSynchronized(), collection.asSynchronized());
Assert.assertEquals(collection, collection.asSynchronized());
}
Aggregations