void () { myFixture.addClass("import org.junit.runner.Runner;" + "public class CustomRunner extends Runner {}"); PsiFile file = myFixture.configureByText("CustomRunnerTest.java", """ import org.junit.rules.ExternalResource; import org.junit.runner.RunWith; @RunWith(CustomRunner.class) public class CustomRunnerTest { @org.junit.Rule public ExternalResource noTest() {return null;} public void foo() {}} """); PsiClass aClass = ((PsiClassOwner)file).getClasses()[0]; TestFramework framework = TestFrameworks.detectFramework(aClass); assertNotNull(framework); assertTrue(framework.isTestClass(aClass)); assertFalse(framework.isTestMethod(aClass.getMethods()[0])); assertTrue(framework.isTestMethod(aClass.getMethods()[1])); }