Unit testing activejdbc code without live database

287 views Asked by At

Any suggestion on how to test activejdbc code without live database? I am unable to follow TDD because at every place it needs a live sql database and I can't mock it. Is having a live sql database for unit testing correct?

1

There are 1 answers

2
ipolevoy On BEST ANSWER

ActiveJDBC reads its metadata from the database on the first access. This means that it requires a database. Typically, you would use a different database for testing than the one you use to run the app. Since ActiveJDBC supports multiple databases you can use H2 In-memory database for your tests.

In any case, what is the purpose of testing ORM classes without a database?