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

Comparing jsr166/src/test/tck/Atomic8Test.java (file contents):
Revision 1.1 by dl, Sun Sep 8 23:00:36 2013 UTC vs.
Revision 1.3 by jsr166, Wed Dec 31 19:05:42 2014 UTC

# Line 5 | Line 5
5   * http://creativecommons.org/publicdomain/zero/1.0/
6   */
7  
8 < import junit.framework.*;
9 < import java.util.*;
10 < import java.util.concurrent.*;
11 < import java.util.concurrent.atomic.*;
8 > import java.util.concurrent.atomic.AtomicInteger;
9 > import java.util.concurrent.atomic.AtomicIntegerArray;
10 > import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
11 > import java.util.concurrent.atomic.AtomicLong;
12 > import java.util.concurrent.atomic.AtomicLongArray;
13 > import java.util.concurrent.atomic.AtomicLongFieldUpdater;
14 > import java.util.concurrent.atomic.AtomicReference;
15 > import java.util.concurrent.atomic.AtomicReferenceArray;
16 > import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
17 >
18 > import junit.framework.Test;
19 > import junit.framework.TestSuite;
20  
21   public class Atomic8Test extends JSR166TestCase {
22  
# Line 37 | Line 45 | public class Atomic8Test extends JSR166T
45      volatile int anIntField;
46      volatile Integer anIntegerField;
47  
48 +    AtomicLongFieldUpdater aLongFieldUpdater() {
49 +        return AtomicLongFieldUpdater.newUpdater
50 +            (Atomic8Test.class, "aLongField");
51 +    }
52 +
53 +    AtomicIntegerFieldUpdater anIntFieldUpdater() {
54 +        return AtomicIntegerFieldUpdater.newUpdater
55 +            (Atomic8Test.class, "anIntField");
56 +    }
57 +
58 +    AtomicReferenceFieldUpdater<Atomic8Test,Integer> anIntegerFieldUpdater() {
59 +        return AtomicReferenceFieldUpdater.newUpdater
60 +            (Atomic8Test.class, Integer.class, "anIntegerField");
61 +    }
62 +
63      /**
64       * AtomicLong getAndUpdate returns previous value and updates
65       * result of supplied function
# Line 77 | Line 100 | public class Atomic8Test extends JSR166T
100          AtomicLong a = new AtomicLong(1L);
101          assertEquals(7L, a.accumulateAndGet(6L, Long::sum));
102          assertEquals(10L, a.accumulateAndGet(3L, Long::sum));
103 +        assertEquals(10L, a.get());
104      }
105  
106      /**
# Line 98 | Line 122 | public class Atomic8Test extends JSR166T
122          AtomicInteger a = new AtomicInteger(1);
123          assertEquals(18, a.updateAndGet(Atomic8Test::addInt17));
124          assertEquals(35, a.updateAndGet(Atomic8Test::addInt17));
125 +        assertEquals(35, a.get());
126      }
127  
128      /**
# Line 119 | Line 144 | public class Atomic8Test extends JSR166T
144          AtomicInteger a = new AtomicInteger(1);
145          assertEquals(7, a.accumulateAndGet(6, Integer::sum));
146          assertEquals(10, a.accumulateAndGet(3, Integer::sum));
147 +        assertEquals(10, a.get());
148      }
149  
150      /**
# Line 140 | Line 166 | public class Atomic8Test extends JSR166T
166          AtomicReference<Integer> a = new AtomicReference<Integer>(one);
167          assertEquals(new Integer(18), a.updateAndGet(Atomic8Test::addInteger17));
168          assertEquals(new Integer(35), a.updateAndGet(Atomic8Test::addInteger17));
169 +        assertEquals(new Integer(35), a.get());
170      }
171  
172      /**
# Line 161 | Line 188 | public class Atomic8Test extends JSR166T
188          AtomicReference<Integer> a = new AtomicReference<Integer>(one);
189          assertEquals(new Integer(7), a.accumulateAndGet(6, Atomic8Test::sumInteger));
190          assertEquals(new Integer(10), a.accumulateAndGet(3, Atomic8Test::sumInteger));
191 +        assertEquals(new Integer(10), a.get());
192      }
193  
194  
# Line 185 | Line 213 | public class Atomic8Test extends JSR166T
213          a.set(0, 1);
214          assertEquals(18L, a.updateAndGet(0, Atomic8Test::addLong17));
215          assertEquals(35L, a.updateAndGet(0, Atomic8Test::addLong17));
216 +        assertEquals(35L, a.get(0));
217      }
218  
219      /**
# Line 208 | Line 237 | public class Atomic8Test extends JSR166T
237          a.set(0, 1);
238          assertEquals(7L, a.accumulateAndGet(0, 6L, Long::sum));
239          assertEquals(10L, a.accumulateAndGet(0, 3L, Long::sum));
240 +        assertEquals(10L, a.get(0));
241      }
242  
243      /**
# Line 231 | Line 261 | public class Atomic8Test extends JSR166T
261          a.set(0, 1);
262          assertEquals(18, a.updateAndGet(0, Atomic8Test::addInt17));
263          assertEquals(35, a.updateAndGet(0, Atomic8Test::addInt17));
264 +        assertEquals(35, a.get(0));
265      }
266  
267      /**
# Line 307 | Line 338 | public class Atomic8Test extends JSR166T
338       * result of supplied function
339       */
340      public void testLongFieldUpdaterGetAndUpdate() {
341 <        AtomicLongFieldUpdater a = AtomicLongFieldUpdater.
311 <            newUpdater(Atomic8Test.class, "aLongField");
341 >        AtomicLongFieldUpdater a = aLongFieldUpdater();
342          a.set(this, 1);
343          assertEquals(1L, a.getAndUpdate(this, Atomic8Test::addLong17));
344          assertEquals(18L, a.getAndUpdate(this, Atomic8Test::addLong17));
345          assertEquals(35L, a.get(this));
346 +        assertEquals(35L, aLongField);
347      }
348  
349      /**
# Line 320 | Line 351 | public class Atomic8Test extends JSR166T
351       * returns result.
352       */
353      public void testLongFieldUpdaterUpdateAndGet() {
354 <        AtomicLongFieldUpdater a = AtomicLongFieldUpdater.
324 <            newUpdater(Atomic8Test.class, "aLongField");
354 >        AtomicLongFieldUpdater a = aLongFieldUpdater();
355          a.set(this, 1);
356          assertEquals(18L, a.updateAndGet(this, Atomic8Test::addLong17));
357          assertEquals(35L, a.updateAndGet(this, Atomic8Test::addLong17));
358 +        assertEquals(35L, a.get(this));
359 +        assertEquals(35L, aLongField);
360      }
361  
362      /**
# Line 332 | Line 364 | public class Atomic8Test extends JSR166T
364       * and updates with supplied function.
365       */
366      public void testLongFieldUpdaterGetAndAccumulate() {
367 <        AtomicLongFieldUpdater a = AtomicLongFieldUpdater.
336 <            newUpdater(Atomic8Test.class, "aLongField");
367 >        AtomicLongFieldUpdater a = aLongFieldUpdater();
368          a.set(this, 1);
369          assertEquals(1L, a.getAndAccumulate(this, 2L, Long::sum));
370          assertEquals(3L, a.getAndAccumulate(this, 3L, Long::sum));
371          assertEquals(6L, a.get(this));
372 +        assertEquals(6L, aLongField);
373      }
374  
375      /**
# Line 345 | Line 377 | public class Atomic8Test extends JSR166T
377       * function and returns result.
378       */
379      public void testLongFieldUpdaterAccumulateAndGet() {
380 <        AtomicLongFieldUpdater a = AtomicLongFieldUpdater.
349 <            newUpdater(Atomic8Test.class, "aLongField");
380 >        AtomicLongFieldUpdater a = aLongFieldUpdater();
381          a.set(this, 1);
382          assertEquals(7L, a.accumulateAndGet(this, 6L, Long::sum));
383          assertEquals(10L, a.accumulateAndGet(this, 3L, Long::sum));
384 +        assertEquals(10L, a.get(this));
385 +        assertEquals(10L, aLongField);
386      }
387  
388      /**
# Line 357 | Line 390 | public class Atomic8Test extends JSR166T
390       * result of supplied function
391       */
392      public void testIntegerFieldUpdaterGetAndUpdate() {
393 <        AtomicIntegerFieldUpdater a = AtomicIntegerFieldUpdater.
361 <            newUpdater(Atomic8Test.class, "anIntField");
393 >        AtomicIntegerFieldUpdater a = anIntFieldUpdater();
394          a.set(this, 1);
395          assertEquals(1, a.getAndUpdate(this, Atomic8Test::addInt17));
396          assertEquals(18, a.getAndUpdate(this, Atomic8Test::addInt17));
397          assertEquals(35, a.get(this));
398 +        assertEquals(35, anIntField);
399      }
400  
401      /**
# Line 370 | Line 403 | public class Atomic8Test extends JSR166T
403       * returns result.
404       */
405      public void testIntegerFieldUpdaterUpdateAndGet() {
406 <        AtomicIntegerFieldUpdater a = AtomicIntegerFieldUpdater.
374 <            newUpdater(Atomic8Test.class, "anIntField");
406 >        AtomicIntegerFieldUpdater a = anIntFieldUpdater();
407          a.set(this, 1);
408          assertEquals(18, a.updateAndGet(this, Atomic8Test::addInt17));
409          assertEquals(35, a.updateAndGet(this, Atomic8Test::addInt17));
410 +        assertEquals(35, a.get(this));
411 +        assertEquals(35, anIntField);
412      }
413  
414      /**
# Line 382 | Line 416 | public class Atomic8Test extends JSR166T
416       * and updates with supplied function.
417       */
418      public void testIntegerFieldUpdaterGetAndAccumulate() {
419 <        AtomicIntegerFieldUpdater a = AtomicIntegerFieldUpdater.
386 <            newUpdater(Atomic8Test.class, "anIntField");
419 >        AtomicIntegerFieldUpdater a = anIntFieldUpdater();
420          a.set(this, 1);
421          assertEquals(1, a.getAndAccumulate(this, 2, Integer::sum));
422          assertEquals(3, a.getAndAccumulate(this, 3, Integer::sum));
423          assertEquals(6, a.get(this));
424 +        assertEquals(6, anIntField);
425      }
426  
427      /**
# Line 395 | Line 429 | public class Atomic8Test extends JSR166T
429       * function and returns result.
430       */
431      public void testIntegerFieldUpdaterAccumulateAndGet() {
432 <        AtomicIntegerFieldUpdater a = AtomicIntegerFieldUpdater.
399 <            newUpdater(Atomic8Test.class, "anIntField");
432 >        AtomicIntegerFieldUpdater a = anIntFieldUpdater();
433          a.set(this, 1);
434          assertEquals(7, a.accumulateAndGet(this, 6, Integer::sum));
435          assertEquals(10, a.accumulateAndGet(this, 3, Integer::sum));
436 +        assertEquals(10, a.get(this));
437 +        assertEquals(10, anIntField);
438      }
439  
440  
# Line 408 | Line 443 | public class Atomic8Test extends JSR166T
443       * and updates result of supplied function
444       */
445      public void testReferenceFieldUpdaterGetAndUpdate() {
446 <        AtomicReferenceFieldUpdater<Atomic8Test,Integer> a = AtomicReferenceFieldUpdater.
412 <            newUpdater(Atomic8Test.class, Integer.class, "anIntegerField");
446 >        AtomicReferenceFieldUpdater<Atomic8Test,Integer> a = anIntegerFieldUpdater();
447          a.set(this, one);
448          assertEquals(new Integer(1), a.getAndUpdate(this, Atomic8Test::addInteger17));
449          assertEquals(new Integer(18), a.getAndUpdate(this, Atomic8Test::addInteger17));
450          assertEquals(new Integer(35), a.get(this));
451 +        assertEquals(new Integer(35), anIntegerField);
452      }
453  
454      /**
# Line 421 | Line 456 | public class Atomic8Test extends JSR166T
456       * function and returns result.
457       */
458      public void testReferenceFieldUpdaterUpdateAndGet() {
459 <        AtomicReferenceFieldUpdater<Atomic8Test,Integer> a = AtomicReferenceFieldUpdater.
425 <            newUpdater(Atomic8Test.class, Integer.class, "anIntegerField");
459 >        AtomicReferenceFieldUpdater<Atomic8Test,Integer> a = anIntegerFieldUpdater();
460          a.set(this, one);
461          assertEquals(new Integer(18), a.updateAndGet(this, Atomic8Test::addInteger17));
462          assertEquals(new Integer(35), a.updateAndGet(this, Atomic8Test::addInteger17));
463 +        assertEquals(new Integer(35), a.get(this));
464 +        assertEquals(new Integer(35), anIntegerField);
465      }
466  
467      /**
# Line 433 | Line 469 | public class Atomic8Test extends JSR166T
469       * with supplied function.
470       */
471      public void testReferenceFieldUpdaterGetAndAccumulate() {
472 <        AtomicReferenceFieldUpdater<Atomic8Test,Integer> a = AtomicReferenceFieldUpdater.
437 <            newUpdater(Atomic8Test.class, Integer.class, "anIntegerField");
472 >        AtomicReferenceFieldUpdater<Atomic8Test,Integer> a = anIntegerFieldUpdater();
473          a.set(this, one);
474          assertEquals(new Integer(1), a.getAndAccumulate(this, 2, Atomic8Test::sumInteger));
475          assertEquals(new Integer(3), a.getAndAccumulate(this, 3, Atomic8Test::sumInteger));
476          assertEquals(new Integer(6), a.get(this));
477 +        assertEquals(new Integer(6), anIntegerField);
478      }
479  
480      /**
# Line 446 | Line 482 | public class Atomic8Test extends JSR166T
482       * supplied function and returns result.
483       */
484      public void testReferenceFieldUpdaterAccumulateAndGet() {
485 <        AtomicReferenceFieldUpdater<Atomic8Test,Integer> a = AtomicReferenceFieldUpdater.
450 <            newUpdater(Atomic8Test.class, Integer.class, "anIntegerField");
485 >        AtomicReferenceFieldUpdater<Atomic8Test,Integer> a = anIntegerFieldUpdater();
486          a.set(this, one);
487          assertEquals(new Integer(7), a.accumulateAndGet(this, 6, Atomic8Test::sumInteger));
488          assertEquals(new Integer(10), a.accumulateAndGet(this, 3, Atomic8Test::sumInteger));
489 +        assertEquals(new Integer(10), a.get(this));
490 +        assertEquals(new Integer(10), anIntegerField);
491      }
492  
493      /**
494 <     * All Atomic getAndUpdate methods throw npe on null function argument
494 >     * All Atomic getAndUpdate methods throw NullPointerException on
495 >     * null function argument
496       */
497      public void testGetAndUpdateNPE() {
498 <        try { new AtomicLong().getAndUpdate(null); shouldThrow();
499 <        } catch(NullPointerException ok) {}
500 <        try { new AtomicInteger().getAndUpdate(null); shouldThrow();
501 <        } catch(NullPointerException ok) {}
502 <        try { new AtomicReference().getAndUpdate(null); shouldThrow();
503 <        } catch(NullPointerException ok) {}
504 <        try { new AtomicLongArray(1).getAndUpdate(0, null); shouldThrow();
505 <        } catch(NullPointerException ok) {}
506 <        try { new AtomicIntegerArray(1).getAndUpdate(0, null); shouldThrow();
507 <        } catch(NullPointerException ok) {}
508 <        try { new AtomicReferenceArray(1).getAndUpdate(0, null); shouldThrow();
509 <        } catch(NullPointerException ok) {}
510 <        try { AtomicLongFieldUpdater.
511 <                newUpdater(Atomic8Test.class, "aLongField").
512 <                getAndUpdate(this, null);
475 <            shouldThrow();
476 <        } catch(NullPointerException ok) {}
477 <        try { AtomicIntegerFieldUpdater.
478 <                newUpdater(Atomic8Test.class, "anIntField").
479 <                getAndUpdate(this, null);
480 <            shouldThrow();
481 <        } catch(NullPointerException ok) {}
482 <        try {  AtomicReferenceFieldUpdater.
483 <                newUpdater(Atomic8Test.class, Integer.class, "anIntegerField").
484 <                getAndUpdate(this, null);
485 <            shouldThrow();
486 <        } catch(NullPointerException ok) {}
487 <    }
488 <
489 <    /**
490 <     * All Atomic updateAndGet methods throw npe on null function argument
491 <     */
492 <    public void testUpdateGetAndNPE() {
493 <        try { new AtomicLong().updateAndGet(null); shouldThrow();
494 <        } catch(NullPointerException ok) {}
495 <        try { new AtomicInteger().updateAndGet(null); shouldThrow();
496 <        } catch(NullPointerException ok) {}
497 <        try { new AtomicReference().updateAndGet(null); shouldThrow();
498 <        } catch(NullPointerException ok) {}
499 <        try { new AtomicLongArray(1).updateAndGet(0, null); shouldThrow();
500 <        } catch(NullPointerException ok) {}
501 <        try { new AtomicIntegerArray(1).updateAndGet(0, null); shouldThrow();
502 <        } catch(NullPointerException ok) {}
503 <        try { new AtomicReferenceArray(1).updateAndGet(0, null); shouldThrow();
504 <        } catch(NullPointerException ok) {}
505 <        try { AtomicLongFieldUpdater.
506 <                newUpdater(Atomic8Test.class, "aLongField").
507 <                updateAndGet(this, null);
508 <            shouldThrow();
509 <        } catch(NullPointerException ok) {}
510 <        try { AtomicIntegerFieldUpdater.
511 <                newUpdater(Atomic8Test.class, "anIntField").
512 <                updateAndGet(this, null);
513 <            shouldThrow();
514 <        } catch(NullPointerException ok) {}
515 <        try {  AtomicReferenceFieldUpdater.
516 <                newUpdater(Atomic8Test.class, Integer.class, "anIntegerField").
517 <                updateAndGet(this, null);
518 <            shouldThrow();
519 <        } catch(NullPointerException ok) {}
498 >        Runnable[] throwingActions = {
499 >            () -> new AtomicLong().getAndUpdate(null),
500 >            () -> new AtomicInteger().getAndUpdate(null),
501 >            () -> new AtomicReference().getAndUpdate(null),
502 >            () -> new AtomicLongArray(1).getAndUpdate(0, null),
503 >            () -> new AtomicIntegerArray(1).getAndUpdate(0, null),
504 >            () -> new AtomicReferenceArray(1).getAndUpdate(0, null),
505 >            () -> aLongFieldUpdater().getAndUpdate(this, null),
506 >            () -> anIntFieldUpdater().getAndUpdate(this, null),
507 >            () -> anIntegerFieldUpdater().getAndUpdate(this, null),
508 >            ////() -> aLongFieldUpdater().getAndUpdate(null, Atomic8Test::addLong17),
509 >            ////() -> anIntFieldUpdater().getAndUpdate(null, Atomic8Test::addInt17),
510 >            ////() -> anIntegerFieldUpdater().getAndUpdate(null, Atomic8Test::addInteger17),
511 >        };
512 >        assertThrows(NullPointerException.class, throwingActions);
513      }
514  
515      /**
516 <     * All Atomic getAndAccumulate methods throw npe on null function argument
516 >     * All Atomic updateAndGet methods throw NullPointerException on null function argument
517 >     */
518 >    public void testUpdateAndGetNPE() {
519 >        Runnable[] throwingActions = {
520 >            () -> new AtomicLong().updateAndGet(null),
521 >            () -> new AtomicInteger().updateAndGet(null),
522 >            () -> new AtomicReference().updateAndGet(null),
523 >            () -> new AtomicLongArray(1).updateAndGet(0, null),
524 >            () -> new AtomicIntegerArray(1).updateAndGet(0, null),
525 >            () -> new AtomicReferenceArray(1).updateAndGet(0, null),
526 >            () -> aLongFieldUpdater().updateAndGet(this, null),
527 >            () -> anIntFieldUpdater().updateAndGet(this, null),
528 >            () -> anIntegerFieldUpdater().updateAndGet(this, null),
529 >        };
530 >        assertThrows(NullPointerException.class, throwingActions);
531 >    }
532 >
533 >    /**
534 >     * All Atomic getAndAccumulate methods throw NullPointerException
535 >     * on null function argument
536       */
537      public void testGetAndAccumulateNPE() {
538 <        try { new AtomicLong().getAndAccumulate(1L, null); shouldThrow();
539 <        } catch(NullPointerException ok) {}
540 <        try { new AtomicInteger().getAndAccumulate(1, null); shouldThrow();
541 <        } catch(NullPointerException ok) {}
542 <        try { new AtomicReference().getAndAccumulate(one, null); shouldThrow();
543 <        } catch(NullPointerException ok) {}
544 <        try { new AtomicLongArray(1).getAndAccumulate(0, 1L, null); shouldThrow();
545 <        } catch(NullPointerException ok) {}
546 <        try { new AtomicIntegerArray(1).getAndAccumulate(0, 1, null); shouldThrow();
547 <        } catch(NullPointerException ok) {}
548 <        try { new AtomicReferenceArray(1).getAndAccumulate(0, one, null); shouldThrow();
549 <        } catch(NullPointerException ok) {}
538 <        try { AtomicLongFieldUpdater.
539 <                newUpdater(Atomic8Test.class, "aLongField").
540 <                getAndAccumulate(this, 1L, null);
541 <            shouldThrow();
542 <        } catch(NullPointerException ok) {}
543 <        try { AtomicIntegerFieldUpdater.
544 <                newUpdater(Atomic8Test.class, "anIntField").
545 <                getAndAccumulate(this, 1, null);
546 <            shouldThrow();
547 <        } catch(NullPointerException ok) {}
548 <        try {  AtomicReferenceFieldUpdater.
549 <                newUpdater(Atomic8Test.class, Integer.class, "anIntegerField").
550 <                getAndAccumulate(this, one, null);
551 <            shouldThrow();
552 <        } catch(NullPointerException ok) {}
538 >        Runnable[] throwingActions = {
539 >            () -> new AtomicLong().getAndAccumulate(1L, null),
540 >            () -> new AtomicInteger().getAndAccumulate(1, null),
541 >            () -> new AtomicReference().getAndAccumulate(one, null),
542 >            () -> new AtomicLongArray(1).getAndAccumulate(0, 1L, null),
543 >            () -> new AtomicIntegerArray(1).getAndAccumulate(0, 1, null),
544 >            () -> new AtomicReferenceArray(1).getAndAccumulate(0, one, null),
545 >            () -> aLongFieldUpdater().getAndAccumulate(this, 1L, null),
546 >            () -> anIntFieldUpdater().getAndAccumulate(this, 1, null),
547 >            () -> anIntegerFieldUpdater().getAndAccumulate(this, one, null),
548 >        };
549 >        assertThrows(NullPointerException.class, throwingActions);
550      }
551  
552      /**
553 <     * All Atomic accumulateAndGet methods throw npe on null function argument
553 >     * All Atomic accumulateAndGet methods throw NullPointerException
554 >     * on null function argument
555       */
556      public void testAccumulateAndGetNPE() {
557 <        try { new AtomicLong().accumulateAndGet(1L, null); shouldThrow();
558 <        } catch(NullPointerException ok) {}
559 <        try { new AtomicInteger().accumulateAndGet(1, null); shouldThrow();
560 <        } catch(NullPointerException ok) {}
561 <        try { new AtomicReference().accumulateAndGet(one, null); shouldThrow();
562 <        } catch(NullPointerException ok) {}
563 <        try { new AtomicLongArray(1).accumulateAndGet(0, 1L, null); shouldThrow();
564 <        } catch(NullPointerException ok) {}
565 <        try { new AtomicIntegerArray(1).accumulateAndGet(0, 1, null); shouldThrow();
566 <        } catch(NullPointerException ok) {}
567 <        try { new AtomicReferenceArray(1).accumulateAndGet(0, one, null); shouldThrow();
568 <        } catch(NullPointerException ok) {}
571 <        try { AtomicLongFieldUpdater.
572 <                newUpdater(Atomic8Test.class, "aLongField").
573 <                accumulateAndGet(this, 1L, null);
574 <            shouldThrow();
575 <        } catch(NullPointerException ok) {}
576 <        try { AtomicIntegerFieldUpdater.
577 <                newUpdater(Atomic8Test.class, "anIntField").
578 <                accumulateAndGet(this, 1, null);
579 <            shouldThrow();
580 <        } catch(NullPointerException ok) {}
581 <        try {  AtomicReferenceFieldUpdater.
582 <                newUpdater(Atomic8Test.class, Integer.class, "anIntegerField").
583 <                accumulateAndGet(this, one, null);
584 <            shouldThrow();
585 <        } catch(NullPointerException ok) {}
557 >        Runnable[] throwingActions = {
558 >            () -> new AtomicLong().accumulateAndGet(1L, null),
559 >            () -> new AtomicInteger().accumulateAndGet(1, null),
560 >            () -> new AtomicReference().accumulateAndGet(one, null),
561 >            () -> new AtomicLongArray(1).accumulateAndGet(0, 1L, null),
562 >            () -> new AtomicIntegerArray(1).accumulateAndGet(0, 1, null),
563 >            () -> new AtomicReferenceArray(1).accumulateAndGet(0, one, null),
564 >            () -> aLongFieldUpdater().accumulateAndGet(this, 1L, null),
565 >            () -> anIntFieldUpdater().accumulateAndGet(this, 1, null),
566 >            () -> anIntegerFieldUpdater().accumulateAndGet(this, one, null),
567 >        };
568 >        assertThrows(NullPointerException.class, throwingActions);
569      }
570  
571   }
589

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines