lundi 23 février 2015

How to annotate injector.getInstance?



I want to inject an instance from Guice injector in my unitTest.


Which diffrentiator can I use?


I know @annotation mechanism is used in ctor params


but junit doesn't allow ctor with params.


should I use class fields' @annotation?



public void setUp() throws Exception {
RoutingResponseRepository routingResponseRepository = injector.getInstance(RoutingResponseRepository.class);
}


e.g.


I want


@firstType RoutingResponseRepository


and


@secondType RoutingResponseRepository




Aucun commentaire:

Enregistrer un commentaire