}
@Test
public void areImagesDeletedWithAlbum() throws Exception {
String imageById = "select i from Image i where album_id = :id";
Album album = helper.getAllAlbums(em).get(0);
Assert.assertNotNull(album);
int allImagesSize = helper.getAllImages(em).size();
int imagesSize = em.createQuery(imageById, Image.class).setParameter("id", album.getId()).getResultList().size();
aa.deleteAlbum(album);
Assert.assertFalse(helper.getAllAlbums(em).contains(album));
List<Image> images = em.createQuery(imageById, Image.class).setParameter("id", album.getId()).getResultList();
Assert.assertTrue(images.isEmpty());
Assert.assertEquals(allImagesSize - imagesSize, helper.getAllImages(em).size());
}