Skip to content

Null Pointer exception when names don't match up #15

@M21B8

Description

@M21B8

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions