예제 #1
0
 /** add throws ISE true if offer fails */
 public void testAddF() {
   Fail q = new Fail();
   try {
     q.add(one);
     shouldThrow();
   } catch (IllegalStateException success) {
   }
 }
예제 #2
0
 /** element throws NSEE if peek returns null */
 public void testElementF() {
   Fail q = new Fail();
   try {
     q.element();
     shouldThrow();
   } catch (NoSuchElementException success) {
   }
 }
예제 #3
0
 /** remove throws NSEE if poll returns null */
 public void testRemoveF() {
   Fail q = new Fail();
   try {
     q.remove();
     shouldThrow();
   } catch (NoSuchElementException success) {
   }
 }
예제 #4
0
 /** addAll throws ISE if an add fails */
 public void testAddAll4() {
   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) {
   }
 }