### Question:
HibernateUtil { public static void delete(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.delete(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 testDelete() throws EntityStorageException { HibernateUtil.clear(); Algorithm expectedAlgorithm = new Algorithm("some file"); HibernateUtil.store(expectedAlgorithm); Algorithm actualAlgorithm = (Algorithm) HibernateUtil.retrieve(Algorithm.class, expectedAlgorithm.getId()); assertEquals(expectedAlgorithm, actualAlgorithm); HibernateUtil.delete(expectedAlgorithm); assertNull(HibernateUtil.retrieve(Algorithm.class, expectedAlgorithm.getId())); HibernateUtil.clear(); }