@Test
public void testAsXml() throws Exception {

    final Group group = new Group().setId(1);
    final User user = new User().setId(2);
    final UserGroup userGroup = new UserGroup().setGroup(group).setUser(user).setProfile(Profile.Editor);
    final Element element = userGroup.asXml();
    assertEquals("" + group.getId(), element.getChildText("group"));
    assertEquals("" + user.getId(), element.getChildText("user"));
    assertEquals(Profile.Editor.name(), element.getChildText("profile"));
}