### Question:
HibernateUtil { public static void update(Object entity) throws EntityStorageException { if (!entity.getClass().isAnnotationPresent(Entity.class)) { throw new EntityStorageException("Entity to delete is missing the Entity annotation."); } Session session = openNewSession(); session.beginTransaction(); session.update(entity); session.getTransaction().commit(); session.close(); }  static synchronized SessionFactory getSessionFactory(); static Session openNewSession(); static void store(Object entity); static void delete(Object entity); static void update(Object entity); static Object retrieve(Class<?> clazz, Serializable id); static List<?> executeNamedQuery(String queryName); static List<?> queryCriteria(Class<?> persistentClass, Criterion... criterionArray); static void shutdown(); static void clear();  }### Answer:
@Test public void testUpdate() throws Exception { HibernateUtil.clear(); String oldName = "some name"; String newName = "some new name"; Algorithm expectedAlgorithm = new Algorithm("example_ind_algorithm.jar"); expectedAlgorithm.setName(oldName); HibernateUtil.store(expectedAlgorithm); assertTrue(expectedAlgorithm.getName().equals(oldName)); expectedAlgorithm.setName(newName); HibernateUtil.update(expectedAlgorithm); assertTrue(expectedAlgorithm.getName().equals(newName)); HibernateUtil.clear(); }