Skip to content

Commit

Permalink
Make JDK names more readable (in unsupported version warning) (#2646)
Browse files Browse the repository at this point in the history
Use better JDK names in unsupported version warning #2635

(cherry picked from commit 4bb4329)
  • Loading branch information
Vassiliy-Kudryashov authored and alisevych committed Oct 5, 2023
1 parent 2e7e0cd commit 25b6ab4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
text = run {
val sdkVersion = findSdkVersionOrNull(this@GenerateTestsDialogWindow.model.srcModule)?.feature
if (sdkVersion != null) {
"SDK version $sdkVersion is not supported, use ${JavaSdkVersion.JDK_1_8}, ${JavaSdkVersion.JDK_11} or ${JavaSdkVersion.JDK_17}"
"SDK version $sdkVersion is not supported, use ${JavaSdkVersion.JDK_1_8.toReadableString()}, ${JavaSdkVersion.JDK_11.toReadableString()} or ${JavaSdkVersion.JDK_17.toReadableString()} instead."
} else {
"SDK is not defined"
}
Expand All @@ -533,6 +533,8 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
})
}

fun JavaSdkVersion.toReadableString() : String = toString().replace("JDK_", "").replace('_', '.')

override fun getBackground(): Color? =
EditorColorsManager.getInstance().globalScheme.getColor(HintUtil.ERROR_COLOR_KEY) ?: super.getBackground()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class UnitTestBotActionTest : BaseTest() {
textEditor().typeAdditionFunction(newClassName)
openUTBotDialogFromProjectViewForClass(newClassName)
assertThat(unitTestBotDialog.generateTestsButton.isEnabled().not())
assertThat(unitTestBotDialog.sdkNotificationLabel.hasText("SDK version 19 is not supported, use JDK_1_8, JDK_11 or JDK_17"))
assertThat(unitTestBotDialog.sdkNotificationLabel.hasText("SDK version 19 is not supported, use 1.8, 11 or 17 instead."))
assertThat(unitTestBotDialog.setupSdkLink.isShowing)
unitTestBotDialog.closeButton.click()
}
Expand Down

0 comments on commit 25b6ab4

Please sign in to comment.