[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.62, Sun Feb 22 04:34:44 2015 UTC revision 1.63, Sat Feb 28 18:23:30 2015 UTC
# Line 185  Line 185 
185       * add succeeds if not full; throws ISE if full       * add succeeds if not full; throws ISE if full
186       */       */
187      public void testAdd() {      public void testAdd() {
         try {  
188              ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE);              ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE);
189              for (int i = 0; i < SIZE; ++i) {              for (int i = 0; i < SIZE; ++i) {
190                  assertTrue(q.add(new Integer(i)));                  assertTrue(q.add(new Integer(i)));
191              }              }
192              assertEquals(0, q.remainingCapacity());              assertEquals(0, q.remainingCapacity());
193            try {
194              q.add(new Integer(SIZE));              q.add(new Integer(SIZE));
195              shouldThrow();              shouldThrow();
196          } catch (IllegalStateException success) {}          } catch (IllegalStateException success) {}
# Line 200  Line 200 
200       * addAll(this) throws IAE       * addAll(this) throws IAE
201       */       */
202      public void testAddAllSelf() {      public void testAddAllSelf() {
         try {  
203              ArrayBlockingQueue q = populatedQueue(SIZE);              ArrayBlockingQueue q = populatedQueue(SIZE);
204            try {
205              q.addAll(q);              q.addAll(q);
206              shouldThrow();              shouldThrow();
207          } catch (IllegalArgumentException success) {}          } catch (IllegalArgumentException success) {}
# Line 212  Line 212 
212       * possibly adding some elements       * possibly adding some elements
213       */       */
214      public void testAddAll3() {      public void testAddAll3() {
         try {  
215              ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE);              ArrayBlockingQueue q = new ArrayBlockingQueue(SIZE);
216              Integer[] ints = new Integer[SIZE];              Integer[] ints = new Integer[SIZE];
217              for (int i = 0; i < SIZE-1; ++i)              for (int i = 0; i < SIZE-1; ++i)
218                  ints[i] = new Integer(i);                  ints[i] = new Integer(i);
219            try {
220              q.addAll(Arrays.asList(ints));              q.addAll(Arrays.asList(ints));
221              shouldThrow();              shouldThrow();
222          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 226  Line 226 
226       * addAll throws ISE if not enough room       * addAll throws ISE if not enough room
227       */       */
228      public void testAddAll4() {      public void testAddAll4() {
         try {  
229              ArrayBlockingQueue q = new ArrayBlockingQueue(1);              ArrayBlockingQueue q = new ArrayBlockingQueue(1);
230              Integer[] ints = new Integer[SIZE];              Integer[] ints = new Integer[SIZE];
231              for (int i = 0; i < SIZE; ++i)              for (int i = 0; i < SIZE; ++i)
232                  ints[i] = new Integer(i);                  ints[i] = new Integer(i);
233            try {
234              q.addAll(Arrays.asList(ints));              q.addAll(Arrays.asList(ints));
235              shouldThrow();              shouldThrow();
236          } catch (IllegalStateException success) {}          } catch (IllegalStateException success) {}

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8