Commit 43b8783b authored by Jörg Richter's avatar Jörg Richter

Add `removeEmailAddress` Core test (#341)

parent bed94046
Pipeline #9885 passed with stages
in 8 minutes and 6 seconds
......@@ -268,6 +268,36 @@ public class PersonTest extends CoreServiceTestEnvironment {
}
}
@Test
public void removeEmailAddress() {
DMXTransaction tx = dmx.beginTx();
try {
definePersonModel();
// create Person
Topic person = createPerson();
ChildTopics children = person.getChildTopics();
Topic ea1 = children.getTopics("dmx.contacts.email_address").get(0);
// add 2nd Email Address
children.add("dmx.contacts.email_address", "me@example2.com");
// remove 1st Email Address
children.addDeletionRef("dmx.contacts.email_address", ea1.getId());
//
// check memory
List<RelatedTopic> emailAddresses = children.getTopics("dmx.contacts.email_address");
assertEquals(1, emailAddresses.size());
// check DB content; refetch ...
List<Topic> persons = dmx.getTopicsByType("dmx.contacts.person");
assertEquals(1, persons.size());
emailAddresses = persons.get(0).getChildTopics().getTopics("dmx.contacts.email_address");
assertEquals(1, emailAddresses.size());
assertEquals("me@example2.com", emailAddresses.get(0).getSimpleValue().toString());
//
tx.success();
} finally {
tx.finish();
}
}
// ------------------------------------------------------------------------------------------------- Private Methods
private void definePersonModel() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment