You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dropwiz...@googlegroups.com
In a Dropwizard project, I am looking to write automated tests to ensure that the DAO objects are correctly interacting with the database.
Does anyone have any suggestions (and examples) on the best way to unit test these DAO objects?
public interface MyDAO {
@SqlQuery("Select name from something where id = :id")
String findNameById(@Bind("id") int id);
}
Tatu Saloranta
unread,
Jul 11, 2012, 1:45:14 PM7/11/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dropwiz...@googlegroups.com
I like using an embedded SQL db like hsql/h2 in in-memory mode, set it
up with default scripts, and run against that. And testing outside
dropwizard itself, i.e. container does not really matter, unless you
are testing wiring of things.
-+ Tatu +-
mgutz
unread,
Jul 16, 2012, 4:18:03 AM7/16/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dropwiz...@googlegroups.com
I do something like this in my JUnit test class.
private userDao;
@Before
public void setup() {
DBI dbi = new DBI("jdbc:postgresql://localhost:5432/db_dev", "pgdev", "secret");