Hi, Generally we mock services replacing them by child or another implementation so no need of mockito and you keep injection consistent...but you can use mockito to implement this other class with a kind of delegate pattern.
- Romain Le 28 août 2012 16:19, "Yann Blazart" <[email protected]> a écrit : > Hi , is there a way to use Mockito instance with Application composer for > unit tests ? > > For example here, is there a solution to use the mockito instance for the > EjbJar ? : > > > > @RunWith(ApplicationComposer.class) > > public class EchoServiceTest { > > > > @Mock > > private DummyService dummyService; > > @EJB > > private EchoService echoService; > > @Before > > public void init() { > > MockitoAnnotations.initMocks(this); > > } > > > > @Module > > public EjbJar createEjbJar() { > > EjbJar ejbJar = new EjbJar(this.getClass().getSimpleName()); > > ejbJar.addEnterpriseBean(new StatelessBean(EchoService.class)); > > // ejbJar.addEnterpriseBean(new StatelessBean); > > return ejbJar; > > } >
