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.2 by jsr166, Mon Sep 9 06:23:16 2013 UTC vs.
Revision 1.6 by jsr166, Fri Jun 17 19:00:48 2016 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  
23      public static void main(String[] args) {
24 <        junit.textui.TestRunner.run(suite());
24 >        main(suite(), args);
25      }
26      public static Test suite() {
27          return new TestSuite(Atomic8Test.class);
# Line 144 | Line 152 | public class Atomic8Test extends JSR166T
152       * result of supplied function
153       */
154      public void testReferenceGetAndUpdate() {
155 <        AtomicReference<Integer> a = new AtomicReference<Integer>(one);
155 >        AtomicReference<Integer> a = new AtomicReference<>(one);
156          assertEquals(new Integer(1), a.getAndUpdate(Atomic8Test::addInteger17));
157          assertEquals(new Integer(18), a.getAndUpdate(Atomic8Test::addInteger17));
158          assertEquals(new Integer(35), a.get());
# Line 155 | Line 163 | public class Atomic8Test extends JSR166T
163       * returns result.
164       */
165      public void testReferenceUpdateAndGet() {
166 <        AtomicReference<Integer> a = new AtomicReference<Integer>(one);
166 >        AtomicReference<Integer> a = new AtomicReference<>(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());
# Line 166 | Line 174 | public class Atomic8Test extends JSR166T
174       * with supplied function.
175       */
176      public void testReferenceGetAndAccumulate() {
177 <        AtomicReference<Integer> a = new AtomicReference<Integer>(one);
177 >        AtomicReference<Integer> a = new AtomicReference<>(one);
178          assertEquals(new Integer(1), a.getAndAccumulate(2, Atomic8Test::sumInteger));
179          assertEquals(new Integer(3), a.getAndAccumulate(3, Atomic8Test::sumInteger));
180          assertEquals(new Integer(6), a.get());
# Line 177 | Line 185 | public class Atomic8Test extends JSR166T
185       * returns result.
186       */
187      public void testReferenceAccumulateAndGet() {
188 <        AtomicReference<Integer> a = new AtomicReference<Integer>(one);
188 >        AtomicReference<Integer> a = new AtomicReference<>(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  
186
194      /**
195       * AtomicLongArray getAndUpdate returns previous value and updates
196       * result of supplied function
# Line 429 | Line 436 | public class Atomic8Test extends JSR166T
436          assertEquals(10, anIntField);
437      }
438  
432
439      /**
440       * AtomicReferenceFieldUpdater getAndUpdate returns previous value
441       * and updates result of supplied function

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines