### Question:
HibernateUtil { public static List<?> executeNamedQuery(String queryName) { Session session = openNewSession(); Query query = session.getNamedQuery(queryName); List<?> result = query.list(); session.close(); return result; }  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 @SuppressWarnings(Constants.SUPPRESS_WARNINGS_UNCHECKED) public void testExecuteNamedQuery() throws EntityStorageException { HibernateUtil.clear(); Algorithm expectedAlgorithm1 = new Algorithm("some path 1"); Algorithm expectedAlgorithm2 = new Algorithm("some path 2"); HibernateUtil.store(expectedAlgorithm1); HibernateUtil.store(expectedAlgorithm2); List<Algorithm> actualAlgorithms = (List<Algorithm>) HibernateUtil.executeNamedQuery("get all"); assertThat(actualAlgorithms, IsIterableContainingInOrder.contains(expectedAlgorithm1, expectedAlgorithm2)); HibernateUtil.clear(); }