HibernateUtil { public static Session getSession() { initialiseFactory(); return sessionFactory.openSession(); } private  HibernateUtil(); static Session getSession();  }
@Test public void testGetSession() { Session session = HibernateUtil.getSession(); assertTrue("Session should be connected.", session.isConnected()); assertTrue("Session should be open.", session.isOpen()); assertFalse("Session should not be dirty.", session.isDirty()); }