use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method longIterator_throws_for_consecutive_remove.
@Test
public void longIterator_throws_for_consecutive_remove() {
MutableLongCollection longIterable = this.classUnderTest();
final MutableLongIterator iterator = longIterable.longIterator();
Assert.assertTrue(iterator.hasNext());
iterator.next();
iterator.remove();
Verify.assertThrows(IllegalStateException.class, new Runnable() {
@Override
public void run() {
iterator.remove();
}
});
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method remove.
@Test
public void remove() {
MutableLongCollection collection = this.classUnderTest();
Assert.assertFalse(collection.remove(-1L));
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L), collection);
Assert.assertTrue(collection.remove(3L));
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L), collection);
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method asUnmodifiable.
@Test
public void asUnmodifiable() {
Verify.assertInstanceOf(this.newWith(1L, 2L, 3L).asUnmodifiable().getClass(), this.classUnderTest().asUnmodifiable());
Assert.assertEquals(this.newWith(1L, 2L, 3L).asUnmodifiable(), this.classUnderTest().asUnmodifiable());
MutableLongCollection collection = this.newWith(1L, 2L, 2L, 3L, 3L, 3L);
MutableLongCollection unmodifiableCollection = this.newWith(1L, 2L, 2L, 3L, 3L, 3L).asUnmodifiable();
Verify.assertInstanceOf(unmodifiableCollection.getClass(), collection.asUnmodifiable());
Assert.assertEquals(unmodifiableCollection, collection.asUnmodifiable());
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method add.
@Test
public void add() {
MutableLongCollection emptyCollection = this.newWith();
Assert.assertTrue(emptyCollection.add(1L));
Assert.assertEquals(this.newMutableCollectionWith(1L), emptyCollection);
MutableLongCollection collection = this.classUnderTest();
Assert.assertTrue(collection.add(4L));
Assert.assertEquals(this.newMutableCollectionWith(1L, 2L, 3L, 4L), collection);
}
use of org.eclipse.collections.api.collection.primitive.MutableLongCollection in project mapdb by jankotek.
the class AbstractMutableLongCollectionTestCase method longIterator_throws_non_empty_collection.
@Override
@Test(expected = NoSuchElementException.class)
public void longIterator_throws_non_empty_collection() {
super.longIterator_throws_non_empty_collection();
MutableLongCollection collection = this.newWith();
collection.add(1L);
collection.add(2L);
collection.add(3L);
LongIterator iterator = collection.longIterator();
while (iterator.hasNext()) {
iterator.next();
}
iterator.next();
}
Aggregations