Search in sources :

Example 86 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testAddAll3.

/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testAddAll3() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE - 1; ++i) ints[i] = new Integer(i);
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 87 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testRemoveFirst.

/**
 * removeFirst() removes first element, or throws NSEE if empty
 */
public void testRemoveFirst() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.removeFirst());
    }
    try {
        q.removeFirst();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
    assertNull(q.peekFirst());
}
Also used : NoSuchElementException(java.util.NoSuchElementException) ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 88 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testAddLastNull.

/**
 * addLast(null) throws NPE
 */
public void testAddLastNull() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    try {
        q.addLast(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 89 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testAddLast.

/**
 * addLast(x) succeeds
 */
public void testAddLast() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    q.addLast(zero);
    q.addLast(one);
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 90 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testContains.

/**
 * contains(x) reports true when elements added but not yet removed
 */
public void testContains() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertTrue(q.contains(new Integer(i)));
        q.poll();
        assertFalse(q.contains(new Integer(i)));
    }
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Aggregations

ConcurrentLinkedDeque (java.util.concurrent.ConcurrentLinkedDeque)209 Test (org.junit.Test)21 NoSuchElementException (java.util.NoSuchElementException)16 Iterator (java.util.Iterator)14 Random (java.util.Random)14 CountDownLatch (java.util.concurrent.CountDownLatch)14 Deque (java.util.Deque)7 ExecutorService (java.util.concurrent.ExecutorService)7 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 ArrayList (java.util.ArrayList)5 Map (java.util.Map)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 IOException (java.io.IOException)4 List (java.util.List)4 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)4 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)4 BlockIdList (alluxio.grpc.BlockIdList)3 BlockStoreLocationProto (alluxio.grpc.BlockStoreLocationProto)3 LocationBlockIdListEntry (alluxio.grpc.LocationBlockIdListEntry)3