Skip to content

Commit 25b6ab4

Browse files
Vassiliy-Kudryashovalisevych
authored andcommitted
Make JDK names more readable (in unsupported version warning) (#2646)
Use better JDK names in unsupported version warning #2635 (cherry picked from commit 4bb4329)
1 parent 2e7e0cd commit 25b6ab4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
520520
text = run {
521521
val sdkVersion = findSdkVersionOrNull(this@GenerateTestsDialogWindow.model.srcModule)?.feature
522522
if (sdkVersion != null) {
523-
"SDK version $sdkVersion is not supported, use ${JavaSdkVersion.JDK_1_8}, ${JavaSdkVersion.JDK_11} or ${JavaSdkVersion.JDK_17}"
523+
"SDK version $sdkVersion is not supported, use ${JavaSdkVersion.JDK_1_8.toReadableString()}, ${JavaSdkVersion.JDK_11.toReadableString()} or ${JavaSdkVersion.JDK_17.toReadableString()} instead."
524524
} else {
525525
"SDK is not defined"
526526
}
@@ -533,6 +533,8 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
533533
})
534534
}
535535

536+
fun JavaSdkVersion.toReadableString() : String = toString().replace("JDK_", "").replace('_', '.')
537+
536538
override fun getBackground(): Color? =
537539
EditorColorsManager.getInstance().globalScheme.getColor(HintUtil.ERROR_COLOR_KEY) ?: super.getBackground()
538540

utbot-intellij/src/test/kotlin/org/utbot/tests/UnitTestBotActionTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class UnitTestBotActionTest : BaseTest() {
6868
textEditor().typeAdditionFunction(newClassName)
6969
openUTBotDialogFromProjectViewForClass(newClassName)
7070
assertThat(unitTestBotDialog.generateTestsButton.isEnabled().not())
71-
assertThat(unitTestBotDialog.sdkNotificationLabel.hasText("SDK version 19 is not supported, use JDK_1_8, JDK_11 or JDK_17"))
71+
assertThat(unitTestBotDialog.sdkNotificationLabel.hasText("SDK version 19 is not supported, use 1.8, 11 or 17 instead."))
7272
assertThat(unitTestBotDialog.setupSdkLink.isShowing)
7373
unitTestBotDialog.closeButton.click()
7474
}

0 commit comments

Comments
 (0)