0

I'm currently figuring out how to make my Wicket Application testable.

Basically, it is a Wicket / Hibernate / Apache Derby setup. Hibernate is used as a filter (as seen on: http://community.jboss.org/wiki/OpenSessionInView / see HibernateSessionRequestFilter) and has a hibernate.cfg.xml file as configuration.

What I want to do is be able to use WicketTester with a custom database that I can rebuild from scratch each testrun. Ideally, a test would contain the connection parameters for Hibernate

Basically, my question is on how to dynamically or at startup-time switch my database?

And more abstract: what is a good approach for this kind of testing?

Rob Audenaerde
  • 19,195
  • 10
  • 76
  • 121

2 Answers2

1

See mockito also. I used it in a lot tests - very helpful. Example: when(someDao.findByOwner(isA(Owner.class))).thenReturn(your-result);

0

See Unit Testing Hibernate with HSQLDB.

animuson
  • 53,861
  • 28
  • 137
  • 147
Rob Audenaerde
  • 19,195
  • 10
  • 76
  • 121