expectedPaintingsNames.add("P11");
expectedPaintingsNames.add("P12");
Iterator<Painting> paintingsIterator = paintings.iterator();
while (paintingsIterator.hasNext()) {
Painting p = paintingsIterator.next();
assertEquals(PersistenceState.COMMITTED, p.getPersistenceState());
assertNotNull(p.getPaintingTitle());
assertTrue(expectedPaintingsNames.contains(p.getPaintingTitle()));
}
String artistName1 = (String) row[1];
assertEquals("A1", artistName1);
Gallery g1 = (Gallery) row[2];
assertEquals("gallery1", g1.getGalleryName());
List exibits = g1.getExhibitArray();
assertNotNull(exibits);
assertFalse(((ValueHolder) exibits).isFault());
assertEquals(2, exibits.size());
row = (Object[]) objects.get(1);
assertEquals(a1, (Artist) row[0]);
assertEquals(artistName1, row[1]);
Gallery g2 = (Gallery) row[2];
assertEquals("gallery2", g2.getGalleryName());
exibits = g2.getExhibitArray();
assertTrue(exibits.isEmpty());
row = (Object[]) objects.get(2);
Artist a2 = (Artist) row[0];
assertEquals("A2", a2.getArtistName());
paintings = a2.getPaintingArray();
assertNotNull(paintings);
assertEquals(1, paintings.size());
Painting p = paintings.get(0);
assertEquals(PersistenceState.COMMITTED, p.getPersistenceState());
assertNotNull(p.getPaintingTitle());
assertEquals("P2", p.getPaintingTitle());
String artistName2 = (String) row[1];
assertEquals("A2", artistName2);
assertEquals(g1, row[2]);