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.

durron597
  • 31,968
  • 17
  • 99
  • 158
Jonathan S. Fisher
  • 8,189
  • 6
  • 46
  • 84

1 Answers1

1

Arquillian persistence? DBUnit?

LightGuard
  • 5,298
  • 19
  • 19
  • 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 Apr 05 '12 at 18:38
  • As I was afraid of... Arquillian interferes with Guice/Jukito. :( – Jonathan S. Fisher Apr 06 '12 at 00:26
  • You could write a guice extension. They're really not that hard. Then you'll have guice and DBUnit. http://www.arquillian.org – LightGuard Apr 06 '12 at 13:04