If the mocks variable name doesn't match the bean name, it can't find the bean to mock, and it falls over with a NPE. I can get round it by making the names match, but seems a bit inflexible.
for example:
@AutowiredSpy ProjectionService spy
java.lang.NullPointerException
at org.spockframework.mock.MockUtil.asMock(MockUtil.java:54)
at org.spockframework.mock.MockUtil.attachMock(MockUtil.java:68)
at com.pchudzik.springmock.spock.spring.MockAttachingTestExecutionListener.beforeTestMethod(MockAttachingTestExecutionListener.java:59)
If the mocks variable name doesn't match the bean name, it can't find the bean to mock, and it falls over with a NPE. I can get round it by making the names match, but seems a bit inflexible.
for example:
@AutowiredSpy ProjectionService spy