@Test public void testGetInvitedModifyNamesAfterAdded() { Party party = new Party(); Person a = new Person(new String(KANY_GARCIA)); Person b = new Person(new String(LAURA_PAUSINI)); Person a1 = new Person(new String(KANY_GARCIA)); Person b1 = new Person(new String(LAURA_PAUSINI)); party.addInvited(a); party.addInvited(b); a.setName(new String(LUIS_MIGUEL)); b.setName(new String(LU)); ArrayList<Person> list; list = party.getInvited(); assertEquals("Incorrect result", 2, list.size()); assertTrue("Incorrect result", list.contains(a1)); assertTrue("Incorrect result", list.contains(b1)); }
@Test public void testGetRSVPModifyNamesAfterAdded() { Party party = new Party(); Person a1 = new Person(new String(KANY_GARCIA)); Person a2 = new Person(new String(KANY_GARCIA)); party.addInvited(a1); party.addRSVP(a1); a1.setName(new String(LUIS_MIGUEL)); ArrayList<Person> list = party.getRSVP(); assertEquals("Incorrect result", 1, list.size()); assertTrue("Incorrect result", list.contains(a2)); }
@Test public void testGetRSVPModifyNamesReturned() { Party party = new Party(); Person a = new Person(new String(KANY_GARCIA)); party.addInvited(a); party.addRSVP(a); ArrayList<Person> list; list = party.getRSVP(); assertEquals("Incorrect result", 1, list.size()); for (Person p : list) { p.setName(new String(MIGUEL_RIOS)); } list = party.getRSVP(); assertEquals("Incorrect result", 1, list.size()); assertTrue("Incorrect result", list.contains(a)); }