From adffccbe0fa16e58622212265f469b249cde9dda Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Thu, 6 May 2021 11:01:59 +0800 Subject: [PATCH 1/4] feat: Support generate tests from a source file --- .../META-INF/MANIFEST.MF | 1 + .../java/test/plugin/util/JUnitPlugin.java | 16 +- .../test/plugin/util/TestGenerationUtils.java | 291 +++++++++++++++++- src/commands/generationCommands.ts | 61 +++- src/extension.ts | 8 +- src/provider/codeActionProvider.ts | 8 +- src/utils/commandUtils.ts | 4 +- 7 files changed, 369 insertions(+), 20 deletions(-) diff --git a/java-extension/com.microsoft.java.test.plugin/META-INF/MANIFEST.MF b/java-extension/com.microsoft.java.test.plugin/META-INF/MANIFEST.MF index 185d4989..994fe38c 100644 --- a/java-extension/com.microsoft.java.test.plugin/META-INF/MANIFEST.MF +++ b/java-extension/com.microsoft.java.test.plugin/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.jdt.core, org.eclipse.core.resources, org.eclipse.jdt.core.manipulation, org.eclipse.text, + org.eclipse.ltk.core.refactoring, org.eclipse.debug.core, org.eclipse.jdt.junit.core, org.eclipse.jdt.junit.runtime, diff --git a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/JUnitPlugin.java b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/JUnitPlugin.java index 6966230f..2d753ab5 100644 --- a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/JUnitPlugin.java +++ b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/JUnitPlugin.java @@ -26,6 +26,15 @@ public class JUnitPlugin implements BundleActivator { + /** + * Client registered command to handle the server-side request to ask user for input + */ + private static final String JAVA_TEST_ASK_CLIENT_FOR_INPUT = "_java.test.askClientForInput"; + + /** + * Client registered command to handle the server-side request to ask user for a choice + */ + private static final String JAVA_TEST_ASK_CLIENT_FOR_CHOICE = "_java.test.askClientForChoice"; public static final String PLUGIN_ID = "java.test.runner"; private static ClasspathUpdateHandler handler = new ClasspathUpdateHandler(); private static BundleContext context; @@ -86,6 +95,11 @@ public static Object askClientForChoice(String placeHolder, List