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()); |
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()); |
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()); |
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()); |