0

I am using Dropwizard and I want to unit test my DAO classes. I saw a bunch of examples online but they seem to be using DAOTestRule which I cannot find in 0.9.2 which is what we use here at work.

None of the blogs explain what is the replacement or why it was deprecated in the first place. The official documentation doesn't detail anything either. How can I go about testing my DAO and setting up an in-memory database for Dropwizard Testing?

halfer
  • 19,824
  • 17
  • 99
  • 186
LeoNeo
  • 739
  • 1
  • 9
  • 28

1 Answers1

0

See issue Can't find DAOTestRule.java at dropwizard-testing maven 1.0.5 version jar.

Answer

That's because it's only available in Dropwizard 1.1.x and later.

https://github.com/dropwizard/dropwizard/commits/master/dropwizard-testing/src/main/java/io/dropwizard/testing/junit/DAOTestRule.java

See also this issue. Looks like it was also back-ported to 1.0.6.

What is the alternative?

Update your DW version.

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720