Code:
public void testHibernateUtilSessionIsOpen() throws HibernateException {
Session s = HibernateUtil.getSession();
HibernateUtil.closeSession();
s = HibernateUtil.getSession();
assertTrue(s.isOpen());
}
runs ok
thank you
let me try to get help from you: i'm also testing if hibernate throws an exception, with this test:
Code:
public void testThrowHibernateException() throws HibernateException {
String a = null;
String b = null;
String c = null;
Double d = null;
Date e = null;
String f = null;
Double g = null;
Double h = null;
Da da = new Da();
try {
da.go(a,b,c,d,e,f,g,h);
fail("should print: he");
}
catch (HibernateException e1) {
System.out.println("yes, does throw HibernateException");
}
}
test runs ok, ecpect for one thing: if i run AllTests, i've to put this one in the very end, if not i get ugly msgs stating:
Quote:
net.sf.hibernate.AssertionFailure: null id in entry (don't flush the Session after an exception occurs)
what am i doing wrong?
thanks again