File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import com.intellij.openapi.progress.ProgressIndicator
13
13
import com.intellij.openapi.progress.Task
14
14
import com.intellij.openapi.project.Project
15
15
import com.intellij.openapi.roots.OrderEnumerator
16
+ import com.intellij.openapi.ui.Messages
16
17
import com.intellij.openapi.util.text.StringUtil
17
18
import com.intellij.psi.PsiClass
18
19
import com.intellij.refactoring.util.classMembers.MemberInfo
@@ -215,6 +216,16 @@ object UtTestsDialogProcessor {
215
216
processedClasses++
216
217
}
217
218
219
+ if (processedClasses == 0 ) {
220
+ invokeLater {
221
+ Messages .showInfoMessage(
222
+ model.project,
223
+ " No methods for test generation were found among selected items" ,
224
+ " No methods found" )
225
+ }
226
+ return
227
+ }
228
+
218
229
indicator.fraction = indicator.fraction.coerceAtLeast(0.9 )
219
230
indicator.text = " Generate code for tests"
220
231
// Commented out to generate tests for collected executions even if action was canceled.
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ class GenerateTestsAction : AnAction() {
54
54
val matchingRoot = ModuleRootManager .getInstance(module).contentEntries
55
55
.flatMap { entry -> entry.sourceFolders.toList() }
56
56
.singleOrNull { folder -> folder.file == srcSourceRoot }
57
- if (matchingRoot == null || matchingRoot.rootType.isForTests) {
57
+ if (srcMethods.isEmpty() || matchingRoot == null || matchingRoot.rootType.isForTests) {
58
58
return null
59
59
}
60
60
You can’t perform that action at this time.
0 commit comments