I'm trying to use jMock to create a mock object. The mock object looks fine - but the thing is it is not injected to the tested class. Here is my code:
@RunWith(JMock.class)
public class FeederFilterTest {
private TestedClass service;
@Mock
private TheMockedInterface mock;
...
}
@Service
public class TestedClass {
@Autowired
private TheMockedInterface interface;
...
}
As I said - the mock object is created as expected - but when I invoke a method on the TestClass
that uses the TheMockInterface
- I get a NullPointerException.
I know that Mockito has @InjectMocks
- does jMock have something like that too?