contact1.setLastName("contact1");
Contact contact2 = new Contact();
contact2.setLastName("contact2");
Customer customer = new Customer();
customer.setName("something");
customer.getContacts().add(contact1);
customer.getContacts().add(contact2);
server.save(customer);
// act
Contact updateContact1 = new Contact();
updateContact1.setId(contact1.getId());
updateContact1.setLastName("contact1-changed");
Contact updateContact3 = new Contact();
//updateContact3.setId(contact3.getId());
updateContact3.setLastName("contact3-added");
Customer updateCustomer = new Customer();
updateCustomer.setId(customer.getId());
updateCustomer.getContacts().add(updateContact1);
updateCustomer.getContacts().add(updateContact3);
// not adding contact2 so it will get deleted
//updateCustomer.getContacts().add(updateContact2);
server.update(updateCustomer);
// assert
Customer assCustomer = server.find(Customer.class, customer.getId());
List<Contact> assContacts = assCustomer.getContacts();
Assert.assertEquals(2, assContacts.size());
Set<Integer> ids = new LinkedHashSet<Integer>();
Set<String> names = new LinkedHashSet<String>();
for (Contact contact : assContacts) {
ids.add(contact.getId());