Skip to content

Commit 5ad8aae

Browse files
committed
Replaced try/catch with runCatching in UtTestsDialogProcessor.createTests
1 parent 8618dff commit 5ad8aae

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,14 @@ object UtTestsDialogProcessor {
194194
null
195195
}
196196

197-
val notEmptyCases = try {
197+
val notEmptyCases = runCatching {
198198
withUtContext(context) {
199199
testCaseGenerator
200200
.generate(methods, model.mockStrategy, model.chosenClassesToMockAlways, model.timeout)
201201
.map { it.summarize(searchDirectory) }
202202
.filterNot { it.executions.isEmpty() && it.errors.isEmpty() }
203203
}
204-
} catch (e: java.lang.IllegalStateException) {
205-
logger.error { "Test generation failed: ${e.message}" }
206-
listOf()
207-
}
204+
}.getOrDefault(listOf())
208205

209206
if (notEmptyCases.isEmpty()) {
210207
showErrorDialogLater(

0 commit comments

Comments
 (0)