@@ -0,0 +1,2917 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.catalina.tribes.membership;%0A%0Aimport java.lang.reflect.Field;%0Aimport java.util.Iterator;%0Aimport java.util.Map.Entry;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport org.apache.catalina.tribes.Member;%0Aimport org.apache.catalina.tribes.membership.Membership.MbrEntry;%0A%0Apublic class TestMembership %7B%0A%0A    @Test%0A    public void testClone() throws Exception %7B%0A        Member m1 = new MemberImpl(%22localhost%22, 1, 1000);%0A        Member m2 = new MemberImpl(%22localhost%22, 2, 1000);%0A        Member m3 = new MemberImpl(%22localhost%22, 3, 1000);%0A%0A        Membership original = new Membership(m1);%0A        original.addMember(m2);%0A        original.addMember(m3);%0A%0A        Membership clone = (Membership) original.clone();%0A%0A        Assert.assertFalse(original == clone);%0A        Assert.assertTrue(original.getClass() == clone.getClass());%0A%0A        Assert.assertTrue(original.local == clone.local);%0A%0A        Assert.assertFalse(original.map == clone.map);%0A        Assert.assertTrue(original.map.size() == clone.map.size());%0A        Iterator%3CEntry%3CMember, MbrEntry%3E%3E originalEntries = original.map.entrySet().iterator();%0A        Iterator%3CEntry%3CMember, MbrEntry%3E%3E cloneEntries = clone.map.entrySet().iterator();%0A        while (originalEntries.hasNext()) %7B%0A            Entry%3CMember, MbrEntry%3E originalEntry = originalEntries.next();%0A            Entry%3CMember, MbrEntry%3E cloneEntry = cloneEntries.next();%0A            Assert.assertTrue(originalEntry.getKey() == cloneEntry.getKey());%0A            Assert.assertTrue(originalEntry.getValue() == cloneEntry.getValue());%0A        %7D%0A%0A        Assert.assertTrue(original.memberComparator == clone.memberComparator);%0A        Assert.assertFalse(original.members == clone.members);%0A        Assert.assertArrayEquals(original.members, clone.members);%0A%0A        // Need to use reflection to access lock since it is a private field%0A        Field f = Membership.class.getDeclaredField(%22membersLock%22);%0A        f.setAccessible(true);%0A        Object originalLock = f.get(original);%0A        Object cloneLock = f.get(clone);%0A        Assert.assertFalse(originalLock == cloneLock);%0A    %7D%0A%7D%0A

Add a test case for the clone() method before I start making changes to fix a SpotBugs issue.