weirddev

Open full view…

NPE when running TestMe plugin on a not fully rcognized projec

lubos2
Thu, 14 May 2020 10:54:57 GMT

Hi Yaron. I tried to run the TestMe plugin on the Tomcat 9.x project which is not recognized fully in intellij Idea (I didn't built it using ant as proposed in the tomcat doc). (This behaviour is the same for any project, that is not fully built in idea.) When you try to generate the Tests on any class (e.g. AjpProcessor.java) it crashes with the following stack trace: java.lang.NullPointerException at com.weirddev.testme.intellij.action.helpers.TargetDirectoryLocator.get OrCreateDirectory(TargetDirectoryLocator.java:50) at com.weirddev.testme.intellij.action.CreateTestMeAction.invoke(CreateTe stMeAction.java:104) at com.weirddev.testme.intellij.action.TestMeCreator.invoke(TestMeCreator .java:35) at com.weirddev.testme.intellij.action.TestMeCreator.createTest(TestMeCre ator.java:25) at com.weirddev.testme.intellij.action.TestMeAdditionalAction.execute(Tes tMeAdditionalAction.java:46) at com.weirddev.testme.intellij.ui.popup.TestMePopUpHandler$3.run(TestMeP opUpHandler.java:109) ... The problem is in: CreateTestMeAction:87 final PsiPackage srcPackage = JavaDirecto ryService.getInstance().getPackage(srcDir); as it is for some reason not possible to get an instance of PsiPackage. Best regards, Lubos.

Yaron
Thu, 14 May 2020 17:12:24 GMT

Thanks Lubos, when IDEA can't build the logical program structure - the PSI tree - then TestMe can't understand the structure as well and generate code. Error handling needs to improve with a proper user notification. I understand this can be an annoying behavor. Thanks a lot for the detailed error report.