GroupMembership groupMembership = new GroupMembership();
groupMembership.setUserId(createdUser.getId());
groupMembership.setGroupId(group.getId());
// Create
IndividualGroupMembershipResponse igmr = API.getGroups().createGroupMembership(groupMembership);
Assert.assertTrue(igmr.getGroupMembership().getId() > 0);
// Update
MultipleGroupMembershipResponse mgmr = API.getGroups().setGroupMembershipAsDefault(createdUser.getId(), igmr.getGroupMembership().getId());
Assert.assertEquals(mgmr.getGroupMemberships().size(), 2);
Assert.assertEquals(mgmr.getGroupMemberships().get(1).getId(), igmr.getGroupMembership().getId());
Assert.assertTrue(mgmr.getGroupMemberships().get(1).getDefaultGroup());
// Delete
Assert.assertTrue(API.getGroups().deleteGroupMembership(igmr.getGroupMembership().getId()));
Assert.assertTrue(API.getUsers().deleteUser(createdUser.getId()));
Assert.assertTrue(API.getGroups().deleteGroup(group.getId()));
}