@Test public void testCreer() throws Exception { Category cat = null; CategoryServiceImpl categoryService = new CategoryServiceImpl(); CategoryDaoImpl categoryDao = new CategoryDaoImpl(); categoryDao.setSessionManager(sessionManager); categoryService.setDao(categoryDao); ImageServiceImpl imageService = new ImageServiceImpl(); ImageDaoImpl imageDao = new ImageDaoImpl(); imageDao.setSessionManager(sessionManager); imageService.setDao(imageDao); // we choose category number 3 for (Category category : categoryService.list(true)) { if (category.getIdentifier().equals(3)) { cat = category; break; } } // we look for the first picture of category 3 Image image = imageService.listByCategory(cat.getIdentifier(), true).get(0); Assert.assertEquals("test de test do not delete", cat.getName()); Assert.assertEquals("20110329194915-0c0b3f36.jpg", image.getFile()); }