void () { RunManager runManager = RunManager.getInstance(myProject); PsiClass psiClass = findClass(getModule1(), CLASS_NAME); PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass); ConfigurationContext context = createContext(psiClass); assertNull(context.findExisting()); RunnerAndConfigurationSettings testClass = context.getConfiguration(); runManager.addConfiguration(testClass); context = createContext(psiClass); assertSame(testClass, context.findExisting()); runManager.setSelectedConfiguration(testClass); context = createContext(psiPackage); assertNull(context.findExisting()); RunnerAndConfigurationSettings testPackage = context.getConfiguration(); runManager.addConfiguration(testPackage); context = createContext(psiPackage); assertSame(testPackage, context.findExisting()); assertSame(testClass, runManager.getSelectedConfiguration()); runManager.setSelectedConfiguration(context.findExisting()); assertSame(testPackage, runManager.getSelectedConfiguration()); }