mercredi 6 mai 2015

Spring Boot Integration Test ReSTful (Mocking Repositories?!)

currently I try to test my application which is written with Spring Boot and has some Repositories that have some JDBC calls like the LargeObjectManager from PostgreSQL.

However that is not really good for testing, how could I replace my repository with a mocked one unit tests?

I Guice I would just throw another Module which only contains mocked Dao classes, but I have no idea how I should do this with Spring Boot.

Also I use Jersey2 for my resources and call them with TestRestTemplate() inside my tests.

Also currently it will always use the database inside my application.properties even for tests, is there a way to use a InMemory Database for testing, like switching out the DataSource in tests?

(I definitly need a good book on these topics, but I don't find a good one yet)

Aucun commentaire:

Enregistrer un commentaire