void () { ModuleRootModificationUtil.addModuleLibrary( getModule(), "jar://" + JavaTestUtil.getJavaTestDataPath() + "/codeInsight/navigation/MyInterfaceLibrary.jar!/" ); @Language("JAVA") String fileText = """ import com.company.MyInterface; public class MyInterfaceImplementation implements My<caret>Interface { @Override public void doIt() {} } """; PsiFile psiFile = myFixture.addFileToProject("MyInterfaceImplementation.java", fileText); myFixture.configureFromExistingVirtualFile(psiFile.getVirtualFile()); PsiClass implementation = myFixture.findClass("MyInterfaceImplementation"); assertNotNull(implementation); PsiClass[] supers = implementation.getSupers(); assertTrue(supers.length == 2 && "com.company.MyInterface".equalsIgnoreCase(supers[1].getQualifiedName())); PsiElement[] targets = getTargets(psiFile); assertSize(5, targets); List<String> names = ContainerUtil.map(targets, element -> ((PsiClass)element).getName()); for(PsiElement element:targets) { PsiClass psiClass = (PsiClass)element; String name = psiClass.getName(); if ("1".equals(name) || "2".equals(name)) { assertNull(psiClass.getModifierList()); assertTrue(psiClass.hasModifierProperty(PsiModifier.FINAL)); assertInstanceOf(psiClass, PsiAnonymousClass.class); } else if (!"MyInterfaceImplementation".equals(name)) { assertNotNull(psiClass.getModifierList()); } } assertContainsElements(names, "1"); assertContainsElements(names, "2"); assertContainsElements(names, "MyLocalClassImplementation"); assertContainsElements(names, "MyLocalClassImplementationInInner"); assertContainsElements(names, "MyInterfaceImplementation"); implementation = myFixture.getJavaFacade().findClass("MyLocalClassImplementation"); assertNull(implementation); implementation = myFixture.getJavaFacade().findClass("MyLocalClassImplementationInInner"); assertNull(implementation); implementation = myFixture.getJavaFacade().findClass("1"); assertNull(implementation); implementation = myFixture.getJavaFacade().findClass("2"); assertNull(implementation); }