use of com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil in project intellij-elixir by KronicDeth.
the class MixExUnitRunningState method createAndAttachConsole.
/**
* Unifies the interface for {@code SMTestRunnerConnectionUtil.createAndAttachConsole} between 141 and later releases
*/
private ConsoleView createAndAttachConsole(@NotNull String testFrameworkName, @NotNull ProcessHandler processHandler, @NotNull TestConsoleProperties consoleProperties) throws ExecutionException {
Class<SMTestRunnerConnectionUtil> klass = SMTestRunnerConnectionUtil.class;
ConsoleView consoleView = null;
try {
Method createAndAttachConsole = klass.getMethod("createAndAttachConsole", String.class, ProcessHandler.class, TestConsoleProperties.class);
try {
consoleView = (ConsoleView) createAndAttachConsole.invoke(null, testFrameworkName, processHandler, consoleProperties);
} catch (IllegalAccessException | InvocationTargetException e) {
LOGGER.error(e);
}
} catch (NoSuchMethodException noSuchCreateAndAttachConsole3Method) {
try {
Method createAndAttachConsole = klass.getMethod("createAndAttachConsole", String.class, ProcessHandler.class, TestConsoleProperties.class, ExecutionEnvironment.class);
try {
consoleView = (ConsoleView) createAndAttachConsole.invoke(null, testFrameworkName, processHandler, consoleProperties, getEnvironment());
} catch (IllegalAccessException | InvocationTargetException e) {
LOGGER.error(e);
}
} catch (NoSuchMethodException noSuchCreateAndAttachConsole4Method) {
noSuchCreateAndAttachConsole4Method.printStackTrace();
}
}
return consoleView;
}
Aggregations