Item item2 = new Item();
item2.setName("Bar2");
JOhm.save(item2);
User user = new User();
JOhm.save(user);
user.getFavoritePurchases().put(1, item2);
user.getFavoritePurchases().put(2, item1);
User savedUser = JOhm.get(User.class, user.getId());
assertEquals(2, savedUser.getFavoritePurchases().size());
Item faveItem1 = savedUser.getFavoritePurchases().get(1);
assertNotNull(faveItem1);
assertEquals(item2.getId(), faveItem1.getId());
assertEquals(item2.getName(), faveItem1.getName());
Item faveItem2 = savedUser.getFavoritePurchases().get(2);
assertNotNull(faveItem2);
assertEquals(item1.getId(), faveItem2.getId());
assertEquals(item1.getName(), faveItem2.getName());
savedUser.getFavoritePurchases().clear();
assertEquals(0, savedUser.getFavoritePurchases().size());
user.getFavoritePurchases().put(1, item2);
user.getFavoritePurchases().put(2, item1);
assertEquals(2, savedUser.getFavoritePurchases().size());
savedUser.getFavoritePurchases().remove(new Integer(1));
assertEquals(1, savedUser.getFavoritePurchases().size());
faveItem2 = savedUser.getFavoritePurchases().get(2);
assertNotNull(faveItem2);
assertEquals(item1.getId(), faveItem2.getId());
assertEquals(item1.getName(), faveItem2.getName());
}