File tree 1 file changed +10
-1
lines changed
utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/models
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import com.intellij.openapi.module.ModuleUtil
15
15
import com.intellij.openapi.project.Project
16
16
import com.intellij.openapi.projectRoots.JavaSdkVersion
17
17
import com.intellij.openapi.vfs.VirtualFile
18
+ import com.intellij.openapi.vfs.newvfs.impl.FakeVirtualFile
18
19
import com.intellij.psi.PsiClass
19
20
import com.intellij.refactoring.util.classMembers.MemberInfo
20
21
import org.jetbrains.kotlin.idea.core.getPackage
@@ -41,7 +42,15 @@ data class GenerateTestsModel(
41
42
fun setSourceRootAndFindTestModule (newTestSourceRoot : VirtualFile ? ) {
42
43
requireNotNull(newTestSourceRoot)
43
44
testSourceRoot = newTestSourceRoot
44
- testModule = ModuleUtil .findModuleForFile(newTestSourceRoot, project)
45
+ var target = newTestSourceRoot
46
+ while (target != null && target is FakeVirtualFile ) {
47
+ target = target.parent
48
+ }
49
+ if (target == null ) {
50
+ error(" Could not find module for $newTestSourceRoot " )
51
+ }
52
+
53
+ testModule = ModuleUtil .findModuleForFile(target, project)
45
54
? : error(" Could not find module for $newTestSourceRoot " )
46
55
}
47
56
You can’t perform that action at this time.
0 commit comments