FileDocCategorySizeDatePackage
AbstractQueueTest.javaAPI DocAndroid 1.5 API4745Wed May 06 22:41:02 BST 2009tests.api.java.util.concurrent

AbstractQueueTest

public class AbstractQueueTest extends JSR166TestCase

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        junit.textui.TestRunner.run (suite());
    
public static junit.framework.Testsuite()

        return new TestSuite(AbstractQueueTest.class);
    
public voidtestAddAll1()
addAll(null) throws NPE

        try {
            Succeed q = new Succeed();
            q.addAll(null);
            shouldThrow();
        }
        catch (NullPointerException success) {}
    
public voidtestAddAll2()
addAll of a collection with null elements throws NPE

        try {
            Succeed q = new Succeed();
            Integer[] ints = new Integer[SIZE];
            q.addAll(Arrays.asList(ints));
            shouldThrow();
        }
        catch (NullPointerException success) {}
    
public voidtestAddAll3()
addAll of a collection with any null elements throws NPE after possibly adding some elements

        try {
            Succeed q = new Succeed();
            Integer[] ints = new Integer[SIZE];
            for (int i = 0; i < SIZE-1; ++i)
                ints[i] = new Integer(i);
            q.addAll(Arrays.asList(ints));
            shouldThrow();
        }
        catch (NullPointerException success) {}
    
public voidtestAddAll4()
addAll throws ISE if an add fails

        try {
            Fail q = new Fail();
            Integer[] ints = new Integer[SIZE];
            for (int i = 0; i < SIZE; ++i)
                ints[i] = new Integer(i);
            q.addAll(Arrays.asList(ints));
            shouldThrow();
        }
        catch (IllegalStateException success) {}
    
public voidtestAddAllSelf()
addAll(this) throws IAE

        try {
            Succeed q = new Succeed();
            q.addAll(q);
            shouldThrow();
        }
        catch (IllegalArgumentException success) {}
    
public voidtestAddF()
add throws ISE true if offer fails

        Fail q = new Fail();
        try {
            q.add(one);
            shouldThrow();
        } catch (IllegalStateException success) {
        }
    
public voidtestAddNPE()
add throws NPE if offer does

        Succeed q = new Succeed();
        try {
            q.add(null);
            shouldThrow();
        } catch (NullPointerException success) {
        }
    
public voidtestAddS()
add returns true if offer succeeds

        Succeed q = new Succeed();
        assertTrue(q.add(two));
    
public voidtestElementF()
element throws NSEE if peek returns null

        Fail q = new Fail();
        try {
            q.element();
            shouldThrow();
        } catch (NoSuchElementException success) {
        }
    
public voidtestElementS()
element returns normally if peek succeeds

        Succeed q = new Succeed();
        q.element();
    
public voidtestRemoveF()
remove throws NSEE if poll returns null

        Fail q = new Fail();
        try {
            q.remove();
            shouldThrow();
        } catch (NoSuchElementException success) {
        }
    
public voidtestRemoveS()
remove returns normally if poll succeeds

        Succeed q = new Succeed();
        q.remove();