void () { PsiFile file = myFixture.addFileToProject( "genSrc/a/Something.java", """ package a; public class Something { public static String s2 = One.t; } """ ); myFixture.allowTreeAccessForFile(file.getVirtualFile()); Project project = myFixture.getProject(); VirtualFile genSrc = ProjectUtil.guessProjectDir(project).findChild("genSrc"); JavaSourceRootProperties properties = JpsJavaExtensionService.getInstance().createSourceRootProperties("", true); PsiTestUtil.addSourceRoot(myFixture.getModule(), genSrc, JavaSourceRootType.SOURCE, properties); PsiClass buildConfig = myFixture.findClass("a.Something"); assertTrue(JavaProjectRootsUtil.isInGeneratedCode(buildConfig.getContainingFile().getVirtualFile(), project)); doTest("com/siyeh/igtest/abstraction/static_method_only_used_in_one_class/global", new StaticMethodOnlyUsedInOneClassInspection()); }