From 5101d5d54a2205734f07e5301b135a5d6440f691 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Sun, 4 Jun 2017 00:47:34 +0300 Subject: [PATCH] support running junit tests --- .gitignore | 2 ++ META-INF/plugin.xml | 6 +++++- src/org/turbanov/execution/cmd/InCmdRunner.java | 17 ++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index b649b6e..e3042c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ out/ .idea/workspace.xml +.idea/kotlinc.xml +.idea/uiDesigner.xml runInCmdPlugin.jar diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index a05fbb5..c651842 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ org.turbanov.execution.cmd RunInCmd - 1.5 + 1.6 Turbanov Andrey --> 1.6 +
    +
  • Support running JUnit tests
  • +

1.5

  • diff --git a/src/org/turbanov/execution/cmd/InCmdRunner.java b/src/org/turbanov/execution/cmd/InCmdRunner.java index d5cab38..6770860 100644 --- a/src/org/turbanov/execution/cmd/InCmdRunner.java +++ b/src/org/turbanov/execution/cmd/InCmdRunner.java @@ -1,9 +1,15 @@ package org.turbanov.execution.cmd; import com.intellij.execution.ExecutionException; +import com.intellij.execution.JavaTestConfigurationBase; import com.intellij.execution.application.ApplicationConfiguration; -import com.intellij.execution.application.ApplicationConfiguration.JavaApplicationCommandLineState; -import com.intellij.execution.configurations.*; +import com.intellij.execution.configurations.CommandLineBuilder; +import com.intellij.execution.configurations.GeneralCommandLine; +import com.intellij.execution.configurations.JavaCommandLineState; +import com.intellij.execution.configurations.JavaParameters; +import com.intellij.execution.configurations.ParametersList; +import com.intellij.execution.configurations.RunProfile; +import com.intellij.execution.configurations.RunProfileState; import com.intellij.execution.process.CapturingProcessHandler; import com.intellij.execution.process.ProcessNotCreatedException; import com.intellij.execution.process.ProcessOutput; @@ -37,7 +43,7 @@ /** * @author Andrey Turbanov */ -public class InCmdRunner extends GenericProgramRunner { +public class InCmdRunner extends GenericProgramRunner { private static final Logger LOG = Logger.getInstance(InCmdRunner.class); private Boolean terminalPluginEnabled; @@ -50,7 +56,8 @@ public String getRunnerId() { @Override public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) { - return executorId.equals(InCmdExecutor.executorId) && profile instanceof ApplicationConfiguration; + return executorId.equals(InCmdExecutor.executorId) && + (profile instanceof ApplicationConfiguration || profile instanceof JavaTestConfigurationBase); } private boolean isTerminalPluginEnabled() { @@ -64,7 +71,7 @@ private boolean isTerminalPluginEnabled() { @Override protected RunContentDescriptor doExecute(@NotNull RunProfileState runProfileState, @NotNull ExecutionEnvironment environment) throws ExecutionException { FileDocumentManager.getInstance().saveAllDocuments(); - JavaApplicationCommandLineState state = (JavaApplicationCommandLineState) runProfileState; + JavaCommandLineState state = (JavaCommandLineState) runProfileState; JavaParameters javaParameters = state.getJavaParameters(); GeneralCommandLine oldCommandLine = CommandLineBuilder.createFromJavaParameters(javaParameters, environment.getProject(), false);