void () { PsiFile file = myFixture.addFileToProject( "genSrc/com/siyeh/igtest/abstraction/Something.java", """ package com.siyeh.igtest.abstraction; public class Something { public static String s2 = StaticMethodInSourceCode.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("com.siyeh.igtest.abstraction.Something"); assertTrue(JavaProjectRootsUtil.isInGeneratedCode(buildConfig.getContainingFile().getVirtualFile(), project)); doTest(); }