diff --git a/utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt b/utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt index 27e2a71df2..f9cf089061 100644 --- a/utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt +++ b/utbot-ui-commons/src/main/kotlin/org/utbot/intellij/plugin/ui/utils/ModuleUtils.kt @@ -184,8 +184,11 @@ fun Module.addDedicatedTestRoot(testSourceRoots: MutableList, l if (testSourceRoots.any { root -> root.dir?.name == dedicatedTestSourceRootName }) return null val moduleInstance = ModuleRootManager.getInstance(this) - val testFolder = moduleInstance.contentEntries.flatMap { it.sourceFolders.toList() } + val testFolder = moduleInstance.contentEntries + .flatMap { it.sourceFolders.toList() } + .filterNot { it.isForGeneratedSources() } .firstOrNull { it.rootType in testSourceRootTypes } + (testFolder?.let { testFolder.file?.parent } ?: testFolder?.contentEntry?.file ?: this.guessModuleDir())?.let { val file = FakeVirtualFile(it, dedicatedTestSourceRootName)