michalborek / mockito-eclipse-tools

Eclipse plugin that simplifies test creation by providing refactorings for Mockito mocks.
7 stars 5 forks source link

NullPointerException on hasLocalFieldWithName #12

Closed lahnsurfer closed 10 years ago

lahnsurfer commented 10 years ago

I always get a NullPointerException if it trigger the quickfix on a field:

java.lang.NullPointerException
    at pl.greenpath.mockito.ide.refactoring.assisst.MocksQuickAssistProcessor.hasLocalFieldWithName(MocksQuickAssistProcessor.java:119)
    at pl.greenpath.mockito.ide.refactoring.assisst.MocksQuickAssistProcessor.isConvertToSpyPossile(MocksQuickAssistProcessor.java:102)
    at pl.greenpath.mockito.ide.refactoring.assisst.MocksQuickAssistProcessor.getAssists(MocksQuickAssistProcessor.java:43)

I am using Eclipse 4.3 and pl.greenpath.mockito.ide.refactoring_1.2.0.201403042101.jar

michalborek commented 10 years ago

Thanks for the ticket. I'm gonna check it right away.

michalborek commented 10 years ago

Ok I see the reason of that.

This feature is implemented for local variables only and that's why it crashed on field.

I'm gonna fix the NPE and in near future support spy on fields.

michalborek commented 10 years ago

Problem is fixed

michalborek commented 10 years ago

Tim, the new version 1.3.0 is out, you can use update site to install new version without mentioned NPE.