mardi 23 décembre 2014

Using a mock Spring bean


I m actually introducting to unit testing with Junit and I am wondering if I m doing the things right.


In fact, I want to test a service in which I inject a repository (a Spring bean in my case with @Bean in a part and @AutoWired in another part).


This repository gives me a list of something taken from the DAL (so dynamically and not always the same thing).


My question is : how can I inject a mock repository in my service object to test the behaviour of my method with a resultset predefined ?


Thanks for advance





Aucun commentaire:

Enregistrer un commentaire