use of org.apache.openejb.test.entity.cmr.onetomany.SongLocal in project tomee by apache.
the class OneToManyTests method testIteratorConcurrentModification.
public void testIteratorConcurrentModification() throws Exception {
resetDB();
beginTransaction();
try {
final ArtistLocal artist = findArtist(new Integer(1));
final SongLocal song = findSong(new Integer(11));
final Set songs = artist.getComposed();
assertFalse(songs.isEmpty());
assertEquals(2, songs.size());
final Iterator iterator = songs.iterator();
songs.remove(song);
assertEquals(1, songs.size());
try {
iterator.next();
fail("expected iterator.next() to throw an ConcurrentModificationException");
} catch (final ConcurrentModificationException ignored) {
}
} finally {
completeTransaction();
}
}
Aggregations