UserImpl user2 = newInstance(UserImpl.class);
user2.setFirstName("first name 2");
user2.setLastName("last name 2");
UserGroupImpl userGroup = newInstance(UserGroupImpl.class);
userGroup.setName("usergroup name");
userGroup.addUser(user1);
userGroup.addUser(user2);
// assert 2 users in collection
assertEquals("Two users in source usergroup expected.", 2, userGroup.getUsers().size());
// get mapper
Mapper mapper = getMapper(new String[] { "mapping-concrete.xml" });
// do mapping
UserGroupPrime userGroupPrime = mapper.map(userGroup, UserGroupPrime.class);
// check mapped group
assertNotNull(userGroupPrime);
assertEquals(userGroup.getName(), userGroupPrime.getName());
// check mapped collection
assertEquals("Two users in mapped usergroup expected.", 2, userGroupPrime.getUsers().size());
}