### Question:
ImageDAOJpa implements ImageDAO { @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) public boolean update(Image image) { entityManager.merge(image); entityManager.flush(); return true; }  @PersistenceContext (unitName = "applicationManagerDB") void setEntityManager(EntityManager entityManager); EntityManager getEntityManager(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) Image getById(int id); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) List<Image> getAll(); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean save(Image image); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean update(Image image); @Override @Transactional(readOnly=false, propagation=Propagation.REQUIRED) boolean delete(Image image); @Override Image getLastImageWithOvfId(String ovfId); @Override Image getDemoCacheImage(String ovfId, String ovfHref); @Override @SuppressWarnings("unchecked") List<Image> getCacheImagesForApplication(Application application);  }### Answer:
@Test public void update() { int size = imageDAO.getAll().size(); Image image = new Image(); image.setOvfId("ovf-id"); image.setProviderImageId("provider-image-id"); boolean saved = imageDAO.save(image); assertTrue(saved); Image imageFromDatabase = imageDAO.getAll().get(size); int id = imageFromDatabase.getId(); assertEquals("ovf-id", imageFromDatabase.getOvfId()); imageFromDatabase.setOvfId("ovf-id2"); boolean updated = imageDAO.update(imageFromDatabase); assertTrue(updated); imageFromDatabase = imageDAO.getById(id); assertEquals("ovf-id2", imageFromDatabase.getOvfId()); }