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

Comparing jsr166/src/test/tck/AtomicReferenceArrayTest.java (file contents):
Revision 1.12 by jsr166, Mon Nov 16 04:57:10 2009 UTC vs.
Revision 1.13 by jsr166, Mon Nov 16 05:30:07 2009 UTC

# Line 11 | Line 11 | import java.util.concurrent.atomic.*;
11   import java.io.*;
12   import java.util.*;
13  
14 < public class AtomicReferenceArrayTest extends JSR166TestCase
15 < {
14 > public class AtomicReferenceArrayTest extends JSR166TestCase {
15      public static void main (String[] args) {
16          junit.textui.TestRunner.run (suite());
17      }
# Line 23 | Line 22 | public class AtomicReferenceArrayTest ex
22      /**
23       * constructor creates array of given size with all elements null
24       */
25 <    public void testConstructor(){
25 >    public void testConstructor() {
26          AtomicReferenceArray<Integer> ai = new AtomicReferenceArray<Integer>(SIZE);
27          for (int i = 0; i < SIZE; ++i) {
28              assertNull(ai.get(i));
# Line 58 | Line 57 | public class AtomicReferenceArrayTest ex
57      /**
58       * get and set for out of bound indices throw IndexOutOfBoundsException
59       */
60 <    public void testIndexing(){
60 >    public void testIndexing() {
61          AtomicReferenceArray<Integer> ai = new AtomicReferenceArray<Integer>(SIZE);
62          try {
63              ai.get(SIZE);
64 <        } catch (IndexOutOfBoundsException success){
64 >        } catch (IndexOutOfBoundsException success) {
65          }
66          try {
67              ai.get(-1);
68 <        } catch (IndexOutOfBoundsException success){
68 >        } catch (IndexOutOfBoundsException success) {
69          }
70          try {
71              ai.set(SIZE, null);
72 <        } catch (IndexOutOfBoundsException success){
72 >        } catch (IndexOutOfBoundsException success) {
73          }
74          try {
75              ai.set(-1, null);
76 <        } catch (IndexOutOfBoundsException success){
76 >        } catch (IndexOutOfBoundsException success) {
77          }
78      }
79  
80      /**
81       * get returns the last value set at index
82       */
83 <    public void testGetSet(){
83 >    public void testGetSet() {
84          AtomicReferenceArray ai = new AtomicReferenceArray(SIZE);
85          for (int i = 0; i < SIZE; ++i) {
86              ai.set(i, one);
# Line 96 | Line 95 | public class AtomicReferenceArrayTest ex
95      /**
96       * get returns the last value lazySet at index by same thread
97       */
98 <    public void testGetLazySet(){
98 >    public void testGetLazySet() {
99          AtomicReferenceArray ai = new AtomicReferenceArray(SIZE);
100          for (int i = 0; i < SIZE; ++i) {
101              ai.lazySet(i, one);
# Line 111 | Line 110 | public class AtomicReferenceArrayTest ex
110      /**
111       * compareAndSet succeeds in changing value if equal to expected else fails
112       */
113 <    public void testCompareAndSet(){
113 >    public void testCompareAndSet() {
114          AtomicReferenceArray ai = new AtomicReferenceArray(SIZE);
115          for (int i = 0; i < SIZE; ++i) {
116              ai.set(i, one);
# Line 152 | Line 151 | public class AtomicReferenceArrayTest ex
151       * repeated weakCompareAndSet succeeds in changing value when equal
152       * to expected
153       */
154 <    public void testWeakCompareAndSet(){
154 >    public void testWeakCompareAndSet() {
155          AtomicReferenceArray ai = new AtomicReferenceArray(SIZE);
156          for (int i = 0; i < SIZE; ++i) {
157              ai.set(i, one);
# Line 167 | Line 166 | public class AtomicReferenceArrayTest ex
166      /**
167       * getAndSet returns previous value and sets to given value at given index
168       */
169 <    public void testGetAndSet(){
169 >    public void testGetAndSet() {
170          AtomicReferenceArray ai = new AtomicReferenceArray(SIZE);
171          for (int i = 0; i < SIZE; ++i) {
172              ai.set(i, one);
# Line 199 | Line 198 | public class AtomicReferenceArrayTest ex
198              for (int i = 0; i < SIZE; ++i) {
199                  assertEquals(r.get(i), l.get(i));
200              }
201 <        } catch (Exception e){
201 >        } catch (Exception e) {
202              unexpectedException();
203          }
204      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines