use of org.springframework.ide.vscode.commons.javadoc.IJavadoc in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testInnerClassLevel2_JavadocForOutputFolder.
@Test
public void html_testInnerClassLevel2_JavadocForOutputFolder() throws Exception {
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("hello.Greeting$TestInnerClass$TestInnerClassLevel2");
assertNotNull(type);
IJavadoc javaDoc = type.getJavaDoc();
assertNotNull(javaDoc);
assertEquals("<div class=\"block\">Comment for level 2 nested class</div>", javaDoc.getRenderable().toHtml());
IField field = type.getField("innerLevel2Field");
assertNotNull(field);
String expected = String.join("\n", "<h4>innerLevel2Field</h4>", "<pre>protected int innerLevel2Field</pre>", "<div class=\"block\">Comment for level 2 inner field</div>");
javaDoc = field.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
IMethod method = type.getMethod("getInnerLevel2Field", Stream.empty());
assertNotNull(method);
expected = String.join("\n", "<h4>getInnerLevel2Field</h4>", "<pre>public int getInnerLevel2Field()</pre>", "<div class=\"block\">Comment for method inside level 2 nested class</div>");
javaDoc = method.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
}
use of org.springframework.ide.vscode.commons.javadoc.IJavadoc in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testMethodJavadoc.
@Test
public void html_testMethodJavadoc() throws Exception {
Assume.assumeTrue(javaVersionHigherThan(6));
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod method = type.getMethod("size", Stream.empty());
assertNotNull(method);
String expected = String.join("\n", "<h4>size</h4>", "<pre>public int size()</pre>", "<div class=\"block\">Returns the number of elements in this list.</div>");
IJavadoc javaDoc = method.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml().substring(0, expected.length()));
}
use of org.springframework.ide.vscode.commons.javadoc.IJavadoc in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testNoJavadocField.
@Test
public void html_testNoJavadocField() throws Exception {
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("hello.GreetingController");
assertNotNull(type);
IField field = type.getField("template");
assertNotNull(field);
String expected = String.join("\n", "<h4>template</h4>", "<pre>public static final <a href=\"http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true\" title=\"class or interface in java.lang\">String</a> template</pre>", "<dl>", "<dt><span class=\"seeLabel\">See Also:</span></dt>", "<dd><a href=\"../constant-values.html#hello.GreetingController.template\">Constant Field Values</a></dd>", "</dl>");
IJavadoc javaDoc = field.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
}
use of org.springframework.ide.vscode.commons.javadoc.IJavadoc in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testInnerClassJavadocForOutputFolder.
@Test
public void html_testInnerClassJavadocForOutputFolder() throws Exception {
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("hello.Greeting$TestInnerClass");
assertNotNull(type);
IJavadoc javaDoc = type.getJavaDoc();
assertNotNull(javaDoc);
assertEquals("<div class=\"block\">Comment for inner class</div>", javaDoc.getRenderable().toHtml());
IField field = type.getField("innerField");
assertNotNull(field);
String expected = String.join("\n", "<h4>innerField</h4>", "<pre>protected int innerField</pre>", "<div class=\"block\">Comment for inner field</div>");
javaDoc = field.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
IMethod method = type.getMethod("getInnerField", Stream.empty());
assertNotNull(method);
expected = String.join("\n", "<h4>getInnerField</h4>", "<pre>public int getInnerField()</pre>", "<div class=\"block\">Comment for method inside nested class</div>");
javaDoc = method.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
}
use of org.springframework.ide.vscode.commons.javadoc.IJavadoc in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testNestedClassJavadoc.
@Test
public void html_testNestedClassJavadoc() throws Exception {
Assume.assumeTrue(javaVersionHigherThan(6));
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("java.util.Map$Entry");
assertNotNull(type);
String expected = String.join("\n", "<div class=\"block\">A map entry (key-value pair). The <tt>Map.entrySet</tt> method returns", " a collection-view of the map, whose elements are of this class. The");
IJavadoc javaDoc = type.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml().substring(0, expected.length()));
}
Aggregations