fun rootModel()

in src/main/kotlin/com/jetbrains/plugin/jtreg/listeners/TestRootManager.kt [136:151]


    fun rootModel(testInfo: TestInfo, project: Project): TestRootModel? {
        val file = testInfo.file
        val module = ModuleUtilCore.findModuleForFile(file, project)
        module?: return null
        val modifiableRootModel = ModuleRootManager.getInstance(module).modifiableModel

        val contentEntry = modifiableRootModel.contentEntries
            .filter {
                val contentRoot = ProjectRootManager.getInstance(project).fileIndex.getContentRootForFile(file)
                return@filter Objects.equals(it.file, contentRoot);
            }.firstOrNull()

        contentEntry?: return null

        return TestRootModel(contentEntry, modifiableRootModel)
    }