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

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

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

revision 1.34, Sat Apr 25 04:55:30 2015 UTC revision 1.35, Fri May 15 18:21:19 2015 UTC
# Line 61  Line 61 
61       */       */
62      public void testConstructor4() {      public void testConstructor4() {
63          try {          try {
64              Integer[] ints = new Integer[SIZE];              new ArrayDeque(Arrays.asList(new Integer[SIZE]));
             new ArrayDeque(Arrays.asList(ints));  
65              shouldThrow();              shouldThrow();
66          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
67      }      }
# Line 71  Line 70 
70       * Initializing from Collection with some null elements throws NPE       * Initializing from Collection with some null elements throws NPE
71       */       */
72      public void testConstructor5() {      public void testConstructor5() {
         try {  
73              Integer[] ints = new Integer[SIZE];              Integer[] ints = new Integer[SIZE];
74              for (int i = 0; i < SIZE-1; ++i)              for (int i = 0; i < SIZE-1; ++i)
75                  ints[i] = new Integer(i);                  ints[i] = new Integer(i);
76            try {
77              new ArrayDeque(Arrays.asList(ints));              new ArrayDeque(Arrays.asList(ints));
78              shouldThrow();              shouldThrow();
79          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 125  Line 124 
124       * push(null) throws NPE       * push(null) throws NPE
125       */       */
126      public void testPushNull() {      public void testPushNull() {
         try {  
127              ArrayDeque q = new ArrayDeque(1);              ArrayDeque q = new ArrayDeque(1);
128            try {
129              q.push(null);              q.push(null);
130              shouldThrow();              shouldThrow();
131          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 160  Line 159 
159       * offer(null) throws NPE       * offer(null) throws NPE
160       */       */
161      public void testOfferNull() {      public void testOfferNull() {
         try {  
162              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
163            try {
164              q.offer(null);              q.offer(null);
165              shouldThrow();              shouldThrow();
166          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 171  Line 170 
170       * offerFirst(null) throws NPE       * offerFirst(null) throws NPE
171       */       */
172      public void testOfferFirstNull() {      public void testOfferFirstNull() {
         try {  
173              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
174            try {
175              q.offerFirst(null);              q.offerFirst(null);
176              shouldThrow();              shouldThrow();
177          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 182  Line 181 
181       * offerLast(null) throws NPE       * offerLast(null) throws NPE
182       */       */
183      public void testOfferLastNull() {      public void testOfferLastNull() {
         try {  
184              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
185            try {
186              q.offerLast(null);              q.offerLast(null);
187              shouldThrow();              shouldThrow();
188          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 226  Line 225 
225       * add(null) throws NPE       * add(null) throws NPE
226       */       */
227      public void testAddNull() {      public void testAddNull() {
         try {  
228              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
229            try {
230              q.add(null);              q.add(null);
231              shouldThrow();              shouldThrow();
232          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 237  Line 236 
236       * addFirst(null) throws NPE       * addFirst(null) throws NPE
237       */       */
238      public void testAddFirstNull() {      public void testAddFirstNull() {
         try {  
239              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
240            try {
241              q.addFirst(null);              q.addFirst(null);
242              shouldThrow();              shouldThrow();
243          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 248  Line 247 
247       * addLast(null) throws NPE       * addLast(null) throws NPE
248       */       */
249      public void testAddLastNull() {      public void testAddLastNull() {
         try {  
250              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
251            try {
252              q.addLast(null);              q.addLast(null);
253              shouldThrow();              shouldThrow();
254          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 292  Line 291 
291       * addAll(null) throws NPE       * addAll(null) throws NPE
292       */       */
293      public void testAddAll1() {      public void testAddAll1() {
         try {  
294              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
295            try {
296              q.addAll(null);              q.addAll(null);
297              shouldThrow();              shouldThrow();
298          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
# Line 303  Line 302 
302       * addAll of a collection with null elements throws NPE       * addAll of a collection with null elements throws NPE
303       */       */
304      public void testAddAll2() {      public void testAddAll2() {
         try {  
305              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
306              Integer[] ints = new Integer[SIZE];          try {
307              q.addAll(Arrays.asList(ints));              q.addAll(Arrays.asList(new Integer[SIZE]));
308              shouldThrow();              shouldThrow();
309          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}
310      }      }
# Line 316  Line 314 
314       * possibly adding some elements       * possibly adding some elements
315       */       */
316      public void testAddAll3() {      public void testAddAll3() {
         try {  
317              ArrayDeque q = new ArrayDeque();              ArrayDeque q = new ArrayDeque();
318              Integer[] ints = new Integer[SIZE];              Integer[] ints = new Integer[SIZE];
319              for (int i = 0; i < SIZE-1; ++i)              for (int i = 0; i < SIZE-1; ++i)
320                  ints[i] = new Integer(i);                  ints[i] = new Integer(i);
321            try {
322              q.addAll(Arrays.asList(ints));              q.addAll(Arrays.asList(ints));
323              shouldThrow();              shouldThrow();
324          } catch (NullPointerException success) {}          } catch (NullPointerException success) {}

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8