I am writing a JUnit test case which tests a findBy
method of a HibernateEnity. Entity gets it's database connection from tomcat managed datasources.
JUnit test case:
MyHibernateEntity entity = new MyHibernateEntity();
expectedResult = entity.findByFK(dummyFK);
How can I run testcase inside tomcat container? We don't have any other Java EE in-container component other then datasources. That's why I need a framework with least footprints. Till now I have tried following:
- Arquillian - Too complex to implement. A lot of configuration.
- Cactus - It has 3 class to extend.
ServletTestCase, JspTestCase and FilterTestCase
. Not sure which one is applicable in my case. DBUnit - Read about it in
JUnit in Action
. I don't know if it is applicable for in container datasources.Note: I understand this test case is not a pure unit testing. I am introducing JUnit in a legacy system and do not have time to resolve integration issues.