ExternalSystemRunConfigurationJavaExtensionTest: restore test dialog

GitOrigin-RevId: c15ddcb6a0ee1e5c0c12a18c52f06b30146c919a
This commit is contained in:
Tagir Valeev
2020-07-23 10:50:08 +07:00
committed by intellij-monorepo-bot
parent ecb8fba035
commit b77aad8faa

View File

@@ -36,18 +36,23 @@ class ExternalSystemRunConfigurationJavaExtensionTest : ExecutionTestCase() {
ExtensionTestUtil.maskExtensions(RunConfigurationExtension.EP_NAME, listOf(CantUpdateJavaParametersExtension()), testRootDisposable)
val configuration = createExternalSystemRunConfiguration()
val notificationsCollector = NotificationsCollector()
Messages.setTestDialog(notificationsCollector)
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
// don't fail this if `LOG.error()` was called for our exception somewhere
if (t is FakeExecutionException) return
super.processError(message, t, details, logger)
val oldTestDialog = Messages.setTestDialog(notificationsCollector)
try {
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
// don't fail this if `LOG.error()` was called for our exception somewhere
if (t is FakeExecutionException) return
super.processError(message, t, details, logger)
}
})
runInEdtAndWait {
ExecutionEnvironmentBuilder.create(DefaultRunExecutor.getRunExecutorInstance(), configuration).buildAndExecute()
}
})
runInEdtAndWait {
ExecutionEnvironmentBuilder.create(DefaultRunExecutor.getRunExecutorInstance(), configuration).buildAndExecute()
assertThat(assertOneElement(notificationsCollector.notifications), containsString(FakeExecutionException.MESSAGE))
}
finally {
Messages.setTestDialog(oldTestDialog)
}
assertThat(assertOneElement(notificationsCollector.notifications), containsString(FakeExecutionException.MESSAGE))
}
fun `test only applicable configuration extensions should be processed`() {