@@ -0,0 +1,1794 @@
+package org.flymine.util;%0A%0Aimport junit.framework.*;%0A%0Aimport java.util.Set;%0A%0Apublic class ConsistentSetTest extends TestCase%0A%7B%0A    public ConsistentSetTest(String arg1) %7B%0A        super(arg1);%0A    %7D%0A%0A   public void testAdd() throws Exception %7B%0A       Object o1 = %22string1%22;%0A       Object o2 = %22string2%22;%0A%0A       Set set = new ConsistentSet();%0A%0A       set.add(o1);%0A       set.add(o2);%0A%0A       assertEquals(2, set.size());%0A       assertTrue(set.contains(o1));%0A       assertTrue(set.contains(o2));%0A   %7D%0A%0A   public void testAddingSame() throws Exception %7B%0A       Object o1 = %22string1%22;%0A       Object o2 = %22string2%22;%0A       Object o3 = %22string2%22;%0A%0A       Set set = new ConsistentSet();%0A%0A       set.add(o1);%0A       set.add(o2);%0A       set.add(o3);%0A%0A       assertEquals(2, set.size());%0A       assertTrue(set.contains(o1));%0A       assertTrue(set.contains(o2));%0A       assertTrue(set.contains(o3));%0A%0A   %7D%0A%0A   public void testAlteringContents() throws Exception %7B%0A       TestObject o1 = new TestObject(%22string1%22);%0A       TestObject o2 = new TestObject(%22string2%22);%0A       TestObject o3 = new TestObject(%22string2%22);%0A       TestObject o4 = new TestObject(%22somethingelse%22);%0A%0A       Set set = new ConsistentSet();%0A%0A       set.add(o1);%0A       set.add(o2);%0A%0A       o2.a = %22somethingelse%22;%0A%0A       assertTrue(set.contains(o1));%0A       assertTrue(!set.contains(o3));%0A       assertTrue(set.contains(o4));%0A   %7D%0A%0A    private class TestObject %7B%0A       public String a;%0A%0A       public TestObject(String str) %7B%0A           this.a = str;%0A       %7D%0A%0A       public boolean equals(Object obj) %7B%0A           if (obj instanceof TestObject) %7B%0A               return a.equals(((TestObject) obj).a);%0A           %7D%0A           return false;%0A       %7D%0A%0A        public int hashCode() %7B%0A            return a.hashCode();%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

Test class for ConsistentSet