public void testAdd_order_ExistingValue() throws NamingException, CloneNotSupportedException { Person person = Person.getInstance(); Person clonePerson = (Person) person.clone(); assertTrue(orderedAttribute.add(person)); assertTrue(orderedAttribute.add(clonePerson)); assertEquals(2, orderedAttribute.size()); assertEquals(orderedAttribute.get(0), orderedAttribute.get(1)); }
public void testAdd_unorder_ExistingValue() throws CloneNotSupportedException, NamingException { Person person = Person.getInstance(); Person clonePerson = (Person) person.clone(); unorderedAttribute.add(person); assertFalse(unorderedAttribute.add(clonePerson)); assertEquals(1, unorderedAttribute.size()); assertEquals(clonePerson, unorderedAttribute.get(0)); }
/** test equals */ public void testEquals() throws CloneNotSupportedException { String ID = "equals"; Person person = Person.getInstance(); Person personClone = (Person) person.clone(); BasicAttribute attribute0 = new BasicAttribute(ID); attribute0.add(person); BasicAttribute attribute1 = new BasicAttribute(ID); attribute1.add(personClone); assertTrue(attribute0.equals(attribute1)); assertTrue(attribute1.equals(attribute0)); assertFalse(attribute0.equals(null)); }