-
Notifications
You must be signed in to change notification settings - Fork 153
Test Plan
- Windows
- macOS
- Linux
-
After the language server is initialized, check the status bar icon is 👍, and the problems view has two errors.
-
Select Foo.java file, invoke
classcode snippet to generate code as below and the problem view error number is reduced to 1.package app; /** * Foo */ public class Foo { }
-
Click the remain error in the diagnostic window, the code action icon should pop up both on the problems view and the side bar of the editor. Select the code action of
Create method 'call()' in type 'Foo'to fix the error. -
Save all the files, and invoke VSCode command
Java: Force Java compilation. There should be no errors. -
Typing the following file of code into the
App.mainmethod, the completion should work for File and there should be two errors in the problem view.File f = new File("demo.txt");
-
Organize Imports:
- Invoke the context menu command
Source Action...==>Organize Imports, there should be only one warning remains in the problem view. - You also can type F1 ->
Organize Imports, it should have the same result.
- Invoke the context menu command
- Open https://github.com/redhat-developer/vscode-java/tree/master/test/resources/projects/maven/salut.
- After the language server is initialized, check the status bar icon is 👍, and the problems views has several warnings but without errors.
- Editing experience is correctly working including diagnostics, code completion and code actions.
- Open https://github.com/redhat-developer/vscode-java/tree/master/test/resources/projects/maven/multimodule.
- After the language server is initialized, check the status bar icon is 👍, and there should be no errors/warning in the problems view.
- Open
Foo.javafile, make sure the editing experience is correctly working including diagnostics, code completion and code action on both modules.- module1\Foo.java
- module2\Foo.java
- Open https://github.com/redhat-developer/vscode-java/tree/master/test/resources/projects/gradle/simple-gradle
- After the language server is initialized, check the status bar icon is 👍, and there should be no errors/problems in the problems view.
- Open
Foo.javafile, make sure the editing experience is correctly working including diagnostics, code completion and code action
- Install JDK 11, and change the VSCode java.home to the JDK 11 path.
- Open https://github.com/redhat-developer/vscode-java/tree/master/test/resources/projects/maven/salut-java11.
- After the language server is initialized, check the status bar icon is 👍, and there should be no errors/problems in the problems view.
- Open
Bar.java, make sure the editing experience is correctly working including diagnostics, code completion and code action
- Install JDK 11.
- Open https://github.com/redhat-developer/vscode-java/tree/master/test/resources/projects/gradle/gradle-11.
- After the language server is initialized, check the status bar icon is 👍, and there should be no errors/problems in the problems view.
- Open
Foo.javafile, make sure the editing experience is correctly working including diagnostics, code completion and code action.
- Open/Create an empty folder
- Add a new Java file, name it Test.java. Check the language server is initialized, and the status bar icon is 👍 after that.
- Type code snippet
classto generate the class body, typemainto generate the main methods. - In the Test.java file, make sure the editing experience is correctly working including diagnostics, code completion and code action.
Open a Java project in VS Code, input the code snippet in each test case, and verify whether the completion works as expected.
▮ - Cursor position
-
Steps
String.▮ -
Expected
Static members are listed, likely with starred items on top of the list.
-
Steps
String a = “”; a.▮
Select an item, e.g.
equals(anObject). -
Expected
The code is completed with parameters, the first parameter is selected, as the following:
String a = ""; a.equals(anObject▮)
-
Steps
import java.▮
-
Expected
Packages are listed in alphabetical order.
-
Steps
import java.util.Arrays; ... Arrays.asList("a", "b").▮
-
Expected
Completion items are listed, with starred items on the top.
-
Steps
Write some simple code, e.g.
import java.util.ArrayList; import java.util.List; public class DemoApplication { public static void main(String[] args) { String message = String.join(" ", args); System.out.println(message); List<String> stringList = new ArrayList<>(); stringList.add(message); } }
-
Expected
Icons of completion items should be correct. e.g
java.util.ArrayListshould have the package icon,Stringshould have the class icon,joinshould have the method icon.
-
Steps
In a simple application, write following code:
a)
String a = ""; a.▮
b)
String a = ""; if (a.▮)
-
Expected
a) and b) should have different recommedations.
-
Steps
In a simple application, write following code:
a)
String a = "[a,b,c]"; if (a.startsWith("[") && a.endsWith("]")) { a.▮ }
b)
String a = "[a,b,c]"; if (a.contains(",")) { String[] arr = a.split(","); System.out.println(String.join("\n", arr)); } if (a.startsWith("[") && a.endsWith("]")) { a.▮ }
c)
String a = "[a,b,c]"; if (a.startsWith("[") && a.endsWith("]")) { a.▮ } if (a.contains(",")) { String[] arr = a.split(","); System.out.println(String.join("\n", arr)); }
-
Expected
a) b) and c)should have the same recommendations.
-
Steps
Create a new .java file, e.g.
HelloWorld.java.class▮From the completion item list, select the one of the type "Snippet".
-
Expected
It should generate following code according to the package.
/** * HelloWorld */ public class HelloWorld { ▮ }
- Can start debug sessions for the following projects. Should verify if the breakpoint is hit and program output is as expected.
- Maven (https://github.com/spring-projects/spring-petclinic)
- Gradle
- Open https://github.com/eclipse/eclipse.jdt.ls/tree/master/org.eclipse.jdt.ls.tests/projects/gradle/simple-gradle, create a main class with main method, and then run it against JDK8
- Open https://github.com/eclipse/eclipse.jdt.ls/tree/master/org.eclipse.jdt.ls.tests/projects/gradle/gradle-13, change the main method declaration in
Foo.javato "public static void main(String[] args)", and then run it against the latest JDK
- Single Folder project
- Open the project https://github.com/testforstephen/singlefolderdemo
- Should Run & Debug LucenceTest against both JDK 8 and the latest JDK version.
- Should Run & Debug Java13Feature against the latest JDK version (JDK13 and above).
- Encoding (https://github.com/microsoft/vscode-java-debug/tree/master/testprojects/14.encoding)
Open the project: https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-maven
- The test explorer can show test case.
- Can run the test cases by clicking
Run Allin test explorer - Open a Java test file, the Code Lens could show above each test cases
- Can run the test cases by clicking the
Run TestCode Lens
Open a Maven project in VS Code, and open a .java file. In body of a function, type below statements.
Gson gson;StringUtils.capitalize("abc");Check if:
- When hovering on the classname, "Resolve unknown type" action is shown.
- When open Code Actions, "Resolve unknown type" is in the list.
- By clicking "Resolve unknown type", following the instructions, it can
- add related dependency into pom.xml
- add related import statement into the .java file
Open the project: https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-maven
- The dependency explorer can show:
- Sources
- JDK libraries
- Maven Dependencies
Open the project: https://github.com/jdneo/invisble-project
- The libraries could be added/removed by clicking buttons in the dependency explorer's
Referenced Librariesnode. - After adding the folder
test-libinto the referenced libraries, the compilation errors should disappear.