Add test case for enable toString object view (#593)

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
This commit is contained in:
Jinbo Wang 2019-05-31 10:28:08 +08:00 committed by GitHub
parent ad82471da0
commit 58e11da115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 0 deletions

View File

@ -523,6 +523,13 @@ Exception in thread "main" java.lang.IllegalStateException
![image](https://user-images.githubusercontent.com/14052197/56104630-1e89d680-5f6b-11e9-87a5-8a17a2ed33b5.png) ![image](https://user-images.githubusercontent.com/14052197/56104630-1e89d680-5f6b-11e9-87a5-8a17a2ed33b5.png)
## Show toString object view
1. Open `28.debugfeatures` project in VS Code.
2. Open `Variables.java` file, and add a breakpoint at line 39.
3. Click Debug CodeLens, check the Variable viewlet.
4. Verify the highlight value in the screenshot below.
![image](https://user-images.githubusercontent.com/14052197/58676978-c9741980-838c-11e9-9f0e-48658fa06bd7.png)
## Enable Java 12 preview for standalone Java files ## Enable Java 12 preview for standalone Java files
1. Install JDK-12. 1. Install JDK-12.
2. Open `28.debugfeatures` project in VS Code, and open `Java12Preview.java` file. 2. Open `28.debugfeatures` project in VS Code, and open `Java12Preview.java` file.

View File

@ -0,0 +1,75 @@
import java.util.*;
public class Variables {
public static void main(String[] args) {
int[] a = new int[100000];
Integer intObj = new Integer(20);
Float floatObj = new Float("1.354");
Character character = new Character('a');
Boolean bool = new Boolean(true);
Map<String, String> emptyMap = new HashMap<>();
Map<String, Integer> bookset = new LinkedHashMap<>();
bookset.put("Algorithm Introduction", 60);
bookset.put("Thinking in JAVA", 50);
Map<String, Map<String, Integer>> smallStore = new HashMap<>();
smallStore.put("Computer Science", bookset);
Map<String, Map<String, Integer>> bigStore = new HashMap<>();
for (int i = 0; i < 100000; i++) {
bigStore.put("key" + i, bookset);
}
List<String> smallList = Arrays.asList("Algorithm Introduction");
List<String> bigList = new ArrayList<>();
for (int i = 0; i < 100000; i++) {
bigList.add("key" + i);
}
School school = new School();
Person person = new Person();
Person person1 = null;
Employee employee = new Employee();
StringException stringException = new StringException();
NullString nullString =new NullString();
Date date = new Date();
String name = "Test";
System.out.println("Exit.");
}
public static class School {
String name = "test";
}
public static class Person {
String name = "jinbo";
@Override
public String toString() {
return "Person [name=" + name + "]";
}
}
public static class Employee extends Person {
}
public static class StringException {
@Override
public String toString() {
throw new RuntimeException("Unimplemented method exception");
}
}
public static class NullString {
@Override
public String toString() {
return null;
}
}
}