Skip to content

Commit 65d95c1

Browse files
Plugin fails with an exception if no SDK is configured for the test module #399 (#424)
1 parent 6f9f2d8 commit 65d95c1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

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

+10-7
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,27 @@ object UtTestsDialogProcessor {
5252
srcClasses: Set<PsiClass>,
5353
focusedMethod: MemberInfo?,
5454
) {
55-
val dialog = createDialog(project, srcClasses, focusedMethod)
56-
if (!dialog.showAndGet()) {
57-
return
55+
createDialog(project, srcClasses, focusedMethod)?.let {
56+
if (it.showAndGet()) createTests(project, it.model)
5857
}
59-
60-
createTests(project, dialog.model)
6158
}
6259

6360
private fun createDialog(
6461
project: Project,
6562
srcClasses: Set<PsiClass>,
6663
focusedMethod: MemberInfo?,
67-
): GenerateTestsDialogWindow {
64+
): GenerateTestsDialogWindow? {
6865
val srcModule = findSrcModule(srcClasses)
6966
val testModule = srcModule.testModule(project)
7067

7168
JdkPathService.jdkPathProvider = PluginJdkPathProvider(project, testModule)
72-
val jdkVersion = testModule.jdkVersion()
69+
val jdkVersion = try {
70+
testModule.jdkVersion()
71+
} catch (e: IllegalStateException) {
72+
// Just ignore it here, notification will be shown in
73+
// org.utbot.intellij.plugin.ui.utils.ModuleUtilsKt.jdkVersionBy
74+
return null
75+
}
7376

7477
return GenerateTestsDialogWindow(
7578
GenerateTestsModel(

0 commit comments

Comments
 (0)