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

Comparing jsr166/src/test/tck/CopyOnWriteArrayListTest.java (file contents):
Revision 1.5 by dl, Thu Sep 25 11:02:41 2003 UTC vs.
Revision 1.8 by jsr166, Mon Nov 2 20:28:31 2009 UTC

# Line 1 | Line 1
1   /*
2 < * Written by members of JCP JSR-166 Expert Group and released to the
3 < * public domain. Use, modify, and redistribute this code in any way
4 < * without acknowledgement. Other contributors include Andrew Wright,
5 < * Jeffrey Hayes, Pat Fischer, Mike Judd.
2 > * Written by Doug Lea with assistance from members of JCP JSR-166
3 > * Expert Group and released to the public domain, as explained at
4 > * http://creativecommons.org/licenses/publicdomain
5 > * Other contributors include Andrew Wright, Jeffrey Hayes,
6 > * Pat Fisher, Mike Judd.
7   */
8  
9   import junit.framework.*;
# Line 11 | Line 12 | import java.util.concurrent.*;
12   import java.io.*;
13  
14   public class CopyOnWriteArrayListTest extends JSR166TestCase{
15 <    
15 >
16      public static void main(String[] args) {
17 <        junit.textui.TestRunner.run (suite());  
17 >        junit.textui.TestRunner.run (suite());
18      }
19  
20      public static Test suite() {
# Line 23 | Line 24 | public class CopyOnWriteArrayListTest ex
24      static CopyOnWriteArrayList populatedArray(int n){
25          CopyOnWriteArrayList a = new CopyOnWriteArrayList();
26          assertTrue(a.isEmpty());
27 <        for (int i = 0; i < n; ++i)
27 >        for (int i = 0; i < n; ++i)
28              a.add(new Integer(i));
29          assertFalse(a.isEmpty());
30          assertEquals(n, a.size());
# Line 47 | Line 48 | public class CopyOnWriteArrayListTest ex
48          for (int i = 0; i < SIZE-1; ++i)
49              ints[i] = new Integer(i);
50          CopyOnWriteArrayList a = new CopyOnWriteArrayList(ints);
51 <        for (int i = 0; i < SIZE; ++i)
51 >        for (int i = 0; i < SIZE; ++i)
52              assertEquals(ints[i], a.get(i));
53      }
54  
# Line 59 | Line 60 | public class CopyOnWriteArrayListTest ex
60          for (int i = 0; i < SIZE-1; ++i)
61              ints[i] = new Integer(i);
62          CopyOnWriteArrayList a = new CopyOnWriteArrayList(Arrays.asList(ints));
63 <        for (int i = 0; i < SIZE; ++i)
63 >        for (int i = 0; i < SIZE; ++i)
64              assertEquals(ints[i], a.get(i));
65      }
66 <        
66 >
67  
68      /**
69       *   addAll  adds each element from the given collection
# Line 140 | Line 141 | public class CopyOnWriteArrayListTest ex
141      }
142  
143      /**
144 <     * adding at an index places it in the indindicated index
144 >     * adding at an index places it in the indicated index
145       */
146      public void testAddIndex() {
147          CopyOnWriteArrayList full = populatedArray(3);
# Line 173 | Line 174 | public class CopyOnWriteArrayListTest ex
174          assertEquals(a.hashCode(), b.hashCode());
175      }
176  
177 <    
177 >
178      /**
179       *   containsAll returns true for collection with subset of elements
180       */
# Line 225 | Line 226 | public class CopyOnWriteArrayListTest ex
226      }
227  
228      /**
229 <     *   iterator() returns an iterator containing the elements of the list
229 >     *   iterator() returns an iterator containing the elements of the list
230       */
231      public void testIterator() {
232          CopyOnWriteArrayList full = populatedArray(SIZE);
# Line 259 | Line 260 | public class CopyOnWriteArrayListTest ex
260          for (int i = 0; i < 3; ++i) {
261              assertTrue(s.indexOf(String.valueOf(i)) >= 0);
262          }
263 <    }        
263 >    }
264  
265      /**
266       *   lastIndexOf returns the index for the given object
# Line 423 | Line 424 | public class CopyOnWriteArrayListTest ex
424              shouldThrow();
425          } catch(IndexOutOfBoundsException e){}
426      }
427 <    
427 >
428      /**
429       *   get throws an IndexOutOfBoundsException on a too high index
430       */
# Line 447 | Line 448 | public class CopyOnWriteArrayListTest ex
448              shouldThrow();
449          } catch(IndexOutOfBoundsException e){}
450      }
451 <    
451 >
452      /**
453       *   set throws an IndexOutOfBoundsException on a too high index
454       */
# Line 471 | Line 472 | public class CopyOnWriteArrayListTest ex
472              shouldThrow();
473          } catch(IndexOutOfBoundsException e){}
474      }
475 <    
475 >
476      /**
477       *   add throws an IndexOutOfBoundsException on a too high index
478       */
# Line 508 | Line 509 | public class CopyOnWriteArrayListTest ex
509              shouldThrow();
510          } catch(IndexOutOfBoundsException e){}
511      }
512 <    
512 >
513      /**
514       *   addAll throws an IndexOutOfBoundsException on a negative index
515       */
# Line 519 | Line 520 | public class CopyOnWriteArrayListTest ex
520              shouldThrow();
521          } catch(IndexOutOfBoundsException e){}
522      }
523 <    
523 >
524      /**
525       *   addAll throws an IndexOutOfBoundsException on a too high index
526       */
# Line 583 | Line 584 | public class CopyOnWriteArrayListTest ex
584  
585      /**
586       *   subList throws IndexOutOfBoundsException when the second index
587 <     *  is lower then the first
587 >     *  is lower then the first
588       */
589      public void testSubList3_IndexOutOfBoundsException() {
590          try {
# Line 616 | Line 617 | public class CopyOnWriteArrayListTest ex
617              unexpectedException();
618          }
619      }
620 <    
620 >
621   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines