Maven, CDI, JUnit, JPA. Would like to run tests against HSQLDB

Go To StackoverFlow.com

1

I've written a JEE6 application using CDI and JPA. My tests are written in JUnit. I'd like to run the database tests against an in-memory HSQLDB database in order to make sure my JPQL (which I consider 'code') is tested. My motivation is that that changing a JPQL statement with a mocked out EntityManager would lead to successful test execution of the code unit.

I'm using Guice and Jukito to run other (non-jpa) tests.

Does anyone have an example for this? I've tried looking around and I've yet to find a good example or framework project to handle this.

2012-04-05 16:09
by Jonathan S. Fisher


1

Arquillian persistence? DBUnit?

2012-04-05 16:31
by LightGuard
DBUnit doesn't have an integration with CDI or Guice (That I can find). I'm looking at Arquillian, but it seems overkill (I get that impression from a lot of the JBoss projects). Nevertheless, I've never heard of it, and it's worth checking out.. - Jonathan S. Fisher 2012-04-05 18:38
As I was afraid of... Arquillian interferes with Guice/Jukito. : - Jonathan S. Fisher 2012-04-06 00:26
You could write a guice extension. They're really not that hard. Then you'll have guice and DBUnit. http://www.arquillian.or - LightGuard 2012-04-06 13:04
Ads