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

Comparing jsr166/src/test/tck/ArrayBlockingQueueTest.java (file contents):
Revision 1.65 by jsr166, Sat Apr 25 04:55:30 2015 UTC vs.
Revision 1.66 by jsr166, Sat May 23 00:53:08 2015 UTC

# Line 104 | Line 104 | public class ArrayBlockingQueueTest exte
104       */
105      public void testConstructor5() {
106          Integer[] ints = new Integer[SIZE];
107 <        for (int i = 0; i < SIZE-1; ++i)
107 >        for (int i = 0; i < SIZE - 1; ++i)
108              ints[i] = i;
109          Collection<Integer> elements = Arrays.asList(ints);
110          try {
# Line 166 | Line 166 | public class ArrayBlockingQueueTest exte
166              assertEquals(i, q.remove());
167          }
168          for (int i = 0; i < SIZE; ++i) {
169 <            assertEquals(SIZE-i, q.remainingCapacity());
169 >            assertEquals(SIZE - i, q.remainingCapacity());
170              assertEquals(SIZE, q.size() + q.remainingCapacity());
171              assertTrue(q.add(i));
172          }
# Line 214 | Line 214 | public class ArrayBlockingQueueTest exte
214      public void testAddAll3() {
215          ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE);
216          Integer[] ints = new Integer[SIZE];
217 <        for (int i = 0; i < SIZE-1; ++i)
217 >        for (int i = 0; i < SIZE - 1; ++i)
218              ints[i] = new Integer(i);
219          try {
220              q.addAll(Arrays.asList(ints));
# Line 572 | Line 572 | public class ArrayBlockingQueueTest exte
572                  assertTrue(changed);
573  
574              assertTrue(q.containsAll(p));
575 <            assertEquals(SIZE-i, q.size());
575 >            assertEquals(SIZE - i, q.size());
576              p.remove();
577          }
578      }
# Line 585 | Line 585 | public class ArrayBlockingQueueTest exte
585              ArrayBlockingQueue q = populatedQueue(SIZE);
586              ArrayBlockingQueue p = populatedQueue(i);
587              assertTrue(q.removeAll(p));
588 <            assertEquals(SIZE-i, q.size());
588 >            assertEquals(SIZE - i, q.size());
589              for (int j = 0; j < i; ++j) {
590                  Integer x = (Integer)(p.remove());
591                  assertFalse(q.contains(x));
# Line 619 | Line 619 | public class ArrayBlockingQueueTest exte
619              checkToArray(q);
620              assertEquals(i, q.poll());
621              checkToArray(q);
622 <            q.add(SIZE+i);
622 >            q.add(SIZE + i);
623          }
624          for (int i = 0; i < SIZE; i++) {
625              checkToArray(q);
626 <            assertEquals(SIZE+i, q.poll());
626 >            assertEquals(SIZE + i, q.poll());
627          }
628      }
629  
# Line 673 | Line 673 | public class ArrayBlockingQueueTest exte
673              checkToArray2(q);
674              assertEquals(i, q.poll());
675              checkToArray2(q);
676 <            q.add(SIZE+i);
676 >            q.add(SIZE + i);
677          }
678          for (int i = 0; i < SIZE; i++) {
679              checkToArray2(q);
680 <            assertEquals(SIZE+i, q.poll());
680 >            assertEquals(SIZE + i, q.poll());
681          }
682      }
683  
# Line 881 | Line 881 | public class ArrayBlockingQueueTest exte
881          final ArrayBlockingQueue q = populatedQueue(SIZE);
882          Thread t = new Thread(new CheckedRunnable() {
883              public void realRun() throws InterruptedException {
884 <                q.put(new Integer(SIZE+1));
884 >                q.put(new Integer(SIZE + 1));
885              }});
886  
887          t.start();
# Line 898 | Line 898 | public class ArrayBlockingQueueTest exte
898       * drainTo(c, n) empties first min(n, size) elements of queue into c
899       */
900      public void testDrainToN() {
901 <        ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE*2);
901 >        ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE * 2);
902          for (int i = 0; i < SIZE + 2; ++i) {
903              for (int j = 0; j < SIZE; j++)
904                  assertTrue(q.offer(new Integer(j)));
# Line 906 | Line 906 | public class ArrayBlockingQueueTest exte
906              q.drainTo(l, i);
907              int k = (i < SIZE) ? i : SIZE;
908              assertEquals(k, l.size());
909 <            assertEquals(SIZE-k, q.size());
909 >            assertEquals(SIZE - k, q.size());
910              for (int j = 0; j < k; ++j)
911                  assertEquals(l.get(j), new Integer(j));
912              do {} while (q.poll() != null);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines