コード例 #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) {
   }
 }