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

Comparing jsr166/src/test/tck/EntryTest.java (file contents):
Revision 1.3 by jsr166, Sat Nov 21 02:07:26 2009 UTC vs.
Revision 1.10 by jsr166, Tue May 31 16:16:23 2011 UTC

# Line 1 | Line 1
1   /*
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
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   import junit.framework.*;
8   import java.util.*;
9 import java.util.concurrent.*;
10 import java.io.*;
9  
10   public class EntryTest extends JSR166TestCase {
11      public static void main(String[] args) {
12 <        junit.textui.TestRunner.run (suite());
12 >        junit.textui.TestRunner.run(suite());
13      }
14      public static Test suite() {
15          return new TestSuite(EntryTest.class);
# Line 22 | Line 20 | public class EntryTest extends JSR166Tes
20      static final String k2 = "2";
21      static final String v2 = "b";
22  
25
23      /**
24       * A new SimpleEntry(k, v) holds k, v.
25       */
# Line 41 | Line 38 | public class EntryTest extends JSR166Tes
38          assertEquals(v1, s.getValue());
39      }
40  
44
41      /**
42       * A new SimpleEntry(entry(k, v)) holds k, v.
43       */
# Line 87 | Line 83 | public class EntryTest extends JSR166Tes
83      public void testNotEquals() {
84          Map.Entry e2 = new AbstractMap.SimpleEntry(k1, v1);
85          Map.Entry e = new AbstractMap.SimpleEntry(k2, v1);
86 <        assertFalse(e2.equals( e));
86 >        assertFalse(e2.equals(e));
87          e = new AbstractMap.SimpleEntry(k1, v2);
88 <        assertFalse(e2.equals( e));
88 >        assertFalse(e2.equals(e));
89          e = new AbstractMap.SimpleEntry(k2, v2);
90 <        assertFalse(e2.equals( e));
90 >        assertFalse(e2.equals(e));
91  
92          Map.Entry s2 = new AbstractMap.SimpleImmutableEntry(k1, v1);
93          Map.Entry s = new AbstractMap.SimpleImmutableEntry(k2, v1);
94 <        assertFalse(s2.equals( s));
94 >        assertFalse(s2.equals(s));
95          s = new AbstractMap.SimpleImmutableEntry(k1, v2);
96 <        assertFalse(s2.equals( s));
96 >        assertFalse(s2.equals(s));
97          s = new AbstractMap.SimpleImmutableEntry(k2, v2);
98 <        assertFalse(s2.equals( s));
98 >        assertFalse(s2.equals(s));
99      }
100  
105
101      /**
102       * getValue returns last setValue for SimpleEntry
103       */
# Line 113 | Line 108 | public class EntryTest extends JSR166Tes
108          assertEquals(v1, e.getValue());
109          e.setValue(k2);
110          assertEquals(k2, e.getValue());
111 <        assertFalse(e2.equals( e));
111 >        assertFalse(e2.equals(e));
112      }
113  
114      /**
115       * setValue for SimpleImmutableEntry throws UnsupportedOperationException
116       */
117 <    public void testsetValue2() {
117 >    public void testSetValue2() {
118          Map.Entry s2 = new AbstractMap.SimpleImmutableEntry(k1, v1);
119          Map.Entry s = new AbstractMap.SimpleImmutableEntry(s2);
120          assertEquals(k1, s.getKey());
121          assertEquals(v1, s.getValue());
122          try {
123              s.setValue(k2);
124 <            fail();
124 >            shouldThrow();
125          } catch (UnsupportedOperationException success) {}
126      }
127   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines