Java Code Examples for java.util.concurrent.LinkedBlockingDeque#putLast()

The following examples show how to use java.util.concurrent.LinkedBlockingDeque#putLast() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * putLast(null) throws NPE
 */
public void testPutLastNull() throws InterruptedException {
    LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE);
    try {
        q.putLast(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 2
/**
 * all elements successfully putLast are contained
 */
public void testPutLast() throws InterruptedException {
    LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        Integer x = new Integer(i);
        q.putLast(x);
        assertTrue(q.contains(x));
    }
    assertEquals(0, q.remainingCapacity());
}
 
Example 3
Source Project: j2objc   File: LinkedBlockingDequeTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * putLast(null) throws NPE
 */
public void testPutLastNull() throws InterruptedException {
    LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE);
    try {
        q.putLast(null);
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
Example 4
Source Project: j2objc   File: LinkedBlockingDequeTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * all elements successfully putLast are contained
 */
public void testPutLast() throws InterruptedException {
    LinkedBlockingDeque q = new LinkedBlockingDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        Integer x = new Integer(i);
        q.putLast(x);
        assertTrue(q.contains(x));
    }
    assertEquals(0, q.remainingCapacity());
}