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