jeudi 20 août 2015

Inject mocks to Abstract class using mockito

I am mocking an abstract class like below:

myAbstractClass = Mockito.mock(MyAbstractClass.class, Mockito.CALLS_REAL_METHODS);

the problem is that MyAbstractClass has some dependencies injected via EJB annotations and there are not setters. Is there a way to inject the dependencies?

@InjectMocks does not work with Abstract classes.

Aucun commentaire:

Enregistrer un commentaire