[cvs] / jsr166 / src / test / tck / ArrayBlockingQueueTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/ArrayBlockingQueueTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.77, Sun Nov 6 03:11:15 2016 UTC revision 1.78, Sun Nov 6 03:49:39 2016 UTC
# Line 231  Line 231 
231       */       */
232      public void testAdd() {      public void testAdd() {
233          ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE);          ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE);
234          for (int i = 0; i < SIZE; ++i) {          for (int i = 0; i < SIZE; i++) assertTrue(q.add((Integer) i));
             assertTrue(q.add(new Integer(i)));  
         }  
235          assertEquals(0, q.remainingCapacity());          assertEquals(0, q.remainingCapacity());
236          try {          try {
237              q.add(new Integer(SIZE));              q.add((Integer) SIZE);
238              shouldThrow();              shouldThrow();
239          } catch (IllegalStateException success) {}          } catch (IllegalStateException success) {}
240      }      }
# Line 270  Line 268 
268      /**      /**
269       * addAll throws ISE if not enough room       * addAll throws ISE if not enough room
270       */       */
271      public void testAddAll4() {      public void testAddAll_insufficientSpace() {
272          ArrayBlockingQueue q = new ArrayBlockingQueue(1);          int size = ThreadLocalRandom.current().nextInt(SIZE);
273          Integer[] ints = new Integer[SIZE];          ArrayBlockingQueue q = populatedQueue(0, size, size, false);
274          for (int i = 0; i < SIZE; ++i)          // Just fits:
275              ints[i] = new Integer(i);          q.addAll(populatedQueue(size, size, 2 * size, false));
276            assertEquals(0, q.remainingCapacity());
277            assertEquals(size, q.size());
278            assertEquals(0, q.peek());
279          try {          try {
280              q.addAll(Arrays.asList(ints));              q = populatedQueue(0, size, size, false);
281                q.addAll(Collections.nCopies(size + 1, 42));
282              shouldThrow();              shouldThrow();
283          } catch (IllegalStateException success) {}          } catch (IllegalStateException success) {}
284      }      }

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.78

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8