Hi,
Is there anything built into ScalikeJDBC to help me mock the DB object and its functions? The problem I am running into is that I have a function like this in my design which I want to unit test.
def doSomething(...): Unit = {
DB.localTx { implicit session =>
// Make a few calls to a DAO
}
}
When I run the unit test I get the following error:
Connection pool is not yet initialized.(name:'default)
java.lang.IllegalStateException: Connection pool is not yet initialized.(name:'default)
In the unit test I would like the code within the transaction block to execute but without a real database connection. I am using Mockito to mock the functions on the DAO.
We are considering wrapping the DB object with something we can mock, but before I go down that path I wanted to see if there was already a solution.
Any suggestions?
Thanks,
Doug