void () { PsiClass myInterface = myFixture.findClass("abc.MyInterface"); PsiMethod[] allMethods = myInterface.getAllMethods(); assertTrue(ContainerUtil.exists(allMethods, m -> m.getName().contains("staticMethod"))); myFixture.configureByText(JavaFileType.INSTANCE, """ class TestMethodAccess { public static void main() { abc.MyInterface foo = new abc.MyInterface() {}; foo.instanceMethod(); } }"""); List<HighlightInfo> highlightInfos = myFixture.doHighlighting(HighlightSeverity.ERROR); assertEmpty(highlightInfos); }