ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/JSR166TestCase.java
(Generate patch)

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.71 by jsr166, Mon Nov 22 06:53:32 2010 UTC vs.
Revision 1.72 by jsr166, Sun Nov 28 08:43:53 2010 UTC

# Line 7 | Line 7
7   */
8  
9   import junit.framework.*;
10 + import java.util.Arrays;
11 + import java.util.NoSuchElementException;
12   import java.util.PropertyPermission;
13   import java.util.concurrent.*;
14   import java.util.concurrent.atomic.AtomicReference;
# Line 1007 | Line 1009 | public class JSR166TestCase extends Test
1009          }
1010      }
1011  
1012 +    public void checkEmpty(BlockingQueue q) {
1013 +        try {
1014 +            assertTrue(q.isEmpty());
1015 +            assertEquals(0, q.size());
1016 +            assertNull(q.peek());
1017 +            assertNull(q.poll());
1018 +            assertNull(q.poll(0, MILLISECONDS));
1019 +            assertEquals(q.toString(), "[]");
1020 +            assertTrue(Arrays.equals(q.toArray(), new Object[0]));
1021 +            assertFalse(q.iterator().hasNext());
1022 +            try {
1023 +                q.element();
1024 +                shouldThrow();
1025 +            } catch (NoSuchElementException success) {}
1026 +            try {
1027 +                q.iterator().next();
1028 +                shouldThrow();
1029 +            } catch (NoSuchElementException success) {}
1030 +            try {
1031 +                q.remove();
1032 +                shouldThrow();
1033 +            } catch (NoSuchElementException success) {}
1034 +        } catch (InterruptedException ie) {
1035 +            threadUnexpectedException(ie);
1036 +        }
1037 +    }
1038 +
1039   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines