ReadWriteLock emailLock = u.getEmailAddresses().getReadWriteLock();
assertEquals(nickNamesLock, emailLock);
assertEquals(TestEventListType2.LOCK, u.getRoles().getReadWriteLock());
// test publisher equality
ListEventPublisher nickNamesPublisher = u.getNickNames().getPublisher();
ListEventPublisher emailPublisher = u.getEmailAddresses().getPublisher();
assertEquals(nickNamesPublisher, emailPublisher);
assertEquals(TestEventListType2.PUBLISHER, u.getRoles().getPublisher());
// lazy collection should still be uninitialized
assertFalse(Hibernate.isInitialized(u.getNickNames()));
assertFalse(Hibernate.isInitialized(u.getEmailAddresses()));
assertFalse(Hibernate.isInitialized(u.getRoles()));
// trigger initialization
assertEquals(2, u.getNickNames().size());
assertTrue(Hibernate.isInitialized(u.getNickNames()));
assertEquals(2, u.getEmailAddresses().size());
assertTrue(Hibernate.isInitialized(u.getEmailAddresses()));
// test ReadWriteLock equality again
nickNamesLock = u.getNickNames().getReadWriteLock();
emailLock = u.getEmailAddresses().getReadWriteLock();
assertEquals(nickNamesLock, emailLock);
assertEquals(TestEventListType2.LOCK, u.getRoles().getReadWriteLock());
// test publisher equality again
nickNamesPublisher = u.getNickNames().getPublisher();
emailPublisher = u.getEmailAddresses().getPublisher();
assertEquals(nickNamesPublisher, emailPublisher);
assertEquals(TestEventListType2.PUBLISHER, u.getRoles().getPublisher());
} else {
// collection should be initialized
assertTrue(Hibernate.isInitialized(u.getNickNames()));
assertTrue(Hibernate.isInitialized(u.getEmailAddresses()));
assertTrue(Hibernate.isInitialized(u.getRoles()));
// test ReadWriteLock equality
final ReadWriteLock nickNamesLock = u.getNickNames().getReadWriteLock();
final ReadWriteLock emailLock = u.getEmailAddresses().getReadWriteLock();
assertEquals(nickNamesLock, emailLock);
assertEquals(TestEventListType2.LOCK, u.getRoles().getReadWriteLock());
// test publisher equality
final ListEventPublisher nickNamesPublisher = u.getNickNames().getPublisher();
final ListEventPublisher emailPublisher = u.getEmailAddresses().getPublisher();
assertEquals(nickNamesPublisher, emailPublisher);
assertEquals(TestEventListType2.PUBLISHER, u.getRoles().getPublisher());
}
assertEquals(PersistentEventList.class, u.getNickNames().getClass());