void () { ExtensionPoint<EntryPoint> point = EntryPointsManagerBase.DEAD_CODE_EP_NAME.getPoint(); EntryPoint extension = new EntryPoint() { @NotNull @Override public String getDisplayName() { return "duh"; } @Override public boolean isEntryPoint(@NotNull RefElement refElement, @NotNull PsiElement psiElement) { return false; } @Override public boolean isEntryPoint(@NotNull PsiElement psiElement) { return psiElement instanceof PsiMethod && ((PsiMethod)psiElement).getName().equals("myTestMethod"); } @Override public boolean isSelected() { return false; } @Override public void setSelected(boolean selected) { } @Override public void readExternal(Element element) { } @Override public void writeExternal(Element element) { } }; point.registerExtension(extension, getTestRootDisposable()); try { myUnusedDeclarationInspection = new UnusedDeclarationInspectionBase(true); doTest(true); } finally { myUnusedDeclarationInspection = new UnusedDeclarationInspectionBase(); } }