Search in sources :

Example 1 with CollectionsFactory

use of org.neo4j.kernel.impl.util.collection.CollectionsFactory in project neo4j by neo4j.

the class MutableLongDiffSetsImplTest method useCollectionsFactory.

@Test
void useCollectionsFactory() {
    final MutableLongSet set1 = new LongHashSet();
    final MutableLongSet set2 = new LongHashSet();
    final CollectionsFactory collectionsFactory = mock(CollectionsFactory.class);
    doReturn(set1, set2).when(collectionsFactory).newLongSet(EmptyMemoryTracker.INSTANCE);
    final MutableLongDiffSetsImpl diffSets = new MutableLongDiffSetsImpl(collectionsFactory, EmptyMemoryTracker.INSTANCE);
    diffSets.add(1L);
    diffSets.remove(2L);
    assertSame(set1, diffSets.getAdded());
    assertSame(set2, diffSets.getRemoved());
    verify(collectionsFactory, times(2)).newLongSet(EmptyMemoryTracker.INSTANCE);
    verifyNoMoreInteractions(collectionsFactory);
}
Also used : LongHashSet(org.eclipse.collections.impl.set.mutable.primitive.LongHashSet) MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) CollectionsFactory(org.neo4j.kernel.impl.util.collection.CollectionsFactory) OnHeapCollectionsFactory(org.neo4j.kernel.impl.util.collection.OnHeapCollectionsFactory) Test(org.junit.jupiter.api.Test)

Aggregations

MutableLongSet (org.eclipse.collections.api.set.primitive.MutableLongSet)1 LongHashSet (org.eclipse.collections.impl.set.mutable.primitive.LongHashSet)1 Test (org.junit.jupiter.api.Test)1 CollectionsFactory (org.neo4j.kernel.impl.util.collection.CollectionsFactory)1 OnHeapCollectionsFactory (org.neo4j.kernel.impl.util.collection.OnHeapCollectionsFactory)1