--- a/langtools/test/jdk/jshell/KullaTesting.java Tue Nov 01 14:47:07 2016 -0700
+++ b/langtools/test/jdk/jshell/KullaTesting.java Wed Nov 02 07:38:37 2016 +0100
@@ -72,11 +72,14 @@
import org.testng.annotations.BeforeMethod;
import jdk.jshell.Diag;
+
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
+
import static jdk.jshell.Snippet.Status.*;
import static org.testng.Assert.*;
import static jdk.jshell.Snippet.SubKind.METHOD_SUBKIND;
+import jdk.jshell.SourceCodeAnalysis.Documentation;
public class KullaTesting {
@@ -946,12 +949,24 @@
}
}
- public void assertDocumentation(String code, String... expected) {
+ public void assertSignature(String code, String... expected) {
int cursor = code.indexOf('|');
code = code.replace("|", "");
assertTrue(cursor > -1, "'|' expected, but not found in: " + code);
- String documentation = getAnalysis().documentation(code, cursor);
- Set<String> docSet = Stream.of(documentation.split("\r?\n")).collect(Collectors.toSet());
+ List<Documentation> documentation = getAnalysis().documentation(code, cursor, false);
+ Set<String> docSet = documentation.stream().map(doc -> doc.signature()).collect(Collectors.toSet());
+ Set<String> expectedSet = Stream.of(expected).collect(Collectors.toSet());
+ assertEquals(docSet, expectedSet, "Input: " + code);
+ }
+
+ public void assertJavadoc(String code, String... expected) {
+ int cursor = code.indexOf('|');
+ code = code.replace("|", "");
+ assertTrue(cursor > -1, "'|' expected, but not found in: " + code);
+ List<Documentation> documentation = getAnalysis().documentation(code, cursor, true);
+ Set<String> docSet = documentation.stream()
+ .map(doc -> doc.signature() + "\n" + doc.javadoc())
+ .collect(Collectors.toSet());
Set<String> expectedSet = Stream.of(expected).collect(Collectors.toSet());
assertEquals(docSet, expectedSet, "Input: " + code);
}