Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin fails with an exception if no SDK is configured for the test m… #424

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,27 @@ object UtTestsDialogProcessor {
srcClasses: Set<PsiClass>,
focusedMethod: MemberInfo?,
) {
val dialog = createDialog(project, srcClasses, focusedMethod)
if (!dialog.showAndGet()) {
return
createDialog(project, srcClasses, focusedMethod)?.let {
if (it.showAndGet()) createTests(project, it.model)
}

createTests(project, dialog.model)
}

private fun createDialog(
project: Project,
srcClasses: Set<PsiClass>,
focusedMethod: MemberInfo?,
): GenerateTestsDialogWindow {
): GenerateTestsDialogWindow? {
val srcModule = findSrcModule(srcClasses)
val testModule = srcModule.testModule(project)

JdkPathService.jdkPathProvider = PluginJdkPathProvider(project, testModule)
val jdkVersion = testModule.jdkVersion()
val jdkVersion = try {
testModule.jdkVersion()
} catch (e: IllegalStateException) {
// Just ignore it here, notification will be shown in
// org.utbot.intellij.plugin.ui.utils.ModuleUtilsKt.jdkVersionBy
return null
}

return GenerateTestsDialogWindow(
GenerateTestsModel(
Expand Down