use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testConstructorJavadoc.
@Test
public void html_testConstructorJavadoc() throws Exception {
Assume.assumeTrue(javaVersionHigherThan(6));
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod method = type.getMethod("<init>", Stream.empty());
assertNotNull(method);
String expected = String.join("\n", "<h4>ArrayList</h4>");
IJavadoc javaDoc = method.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml().substring(0, expected.length()));
}
use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testClassJavadoc.
@Test
public void html_testClassJavadoc() throws Exception {
Assume.assumeTrue(javaVersionHigherThan(6));
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("java.util.Map");
assertNotNull(type);
String expected = String.join("\n", "<div class=\"block\">An object that maps keys to values. A map cannot contain duplicate keys;", " each key can map to at most one value.");
IJavadoc javaDoc = type.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml().substring(0, expected.length()));
}
use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testFieldAndMethodJavadocForJar.
@Test
public void html_testFieldAndMethodJavadocForJar() throws Exception {
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("org.springframework.boot.SpringApplication");
assertNotNull(type);
IField field = type.getField("BANNER_LOCATION_PROPERTY_VALUE");
assertNotNull(field);
String expected = String.join("\n", "<h4>BANNER_LOCATION_PROPERTY_VALUE</h4>", "<pre>public static final <a href=\"http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true\" title=\"class or interface in java.lang\">String</a> BANNER_LOCATION_PROPERTY_VALUE</pre>", "<div class=\"block\">Default banner location.</div>", "<dl>", "<dt><span class=\"seeLabel\">See Also:</span></dt>", "<dd><a href=\"../../../constant-values.html#org.springframework.boot.SpringApplication.BANNER_LOCATION_PROPERTY_VALUE\">Constant Field Values</a></dd>", "</dl>");
IJavadoc javaDoc = field.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
IMethod method = type.getMethod("getListeners", Stream.empty());
assertNotNull(method);
expected = String.join("\n", "<h4>getListeners</h4>", "<pre>public <a href=\"http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true\" title=\"class or interface in java.util\">Set</a><org.springframework.context.ApplicationListener<?>> getListeners()</pre>", "<div class=\"block\">Returns read-only ordered Set of the <code>ApplicationListener</code>s that will be", " applied to the SpringApplication and registered with the <code>ApplicationContext</code>", " .</div>", "<dl>", "<dt><span class=\"returnLabel\">Returns:</span></dt>", "<dd>the listeners</dd>", "</dl>");
javaDoc = method.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
}
use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testJavadocOutputFolder.
@Test
public void html_testJavadocOutputFolder() throws Exception {
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("hello.Greeting");
assertNotNull(type);
String expected = "<div class=\"block\">Comment for Greeting class</div>";
IJavadoc javaDoc = type.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
IField field = type.getField("id");
assertNotNull(field);
expected = String.join("\n", "<h4>id</h4>", "<pre>protected final long id</pre>", "<div class=\"block\">Comment for id field</div>");
javaDoc = field.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
IMethod method = type.getMethod("getId", Stream.empty());
assertNotNull(method);
expected = String.join("\n", "<h4>getId</h4>", "<pre>public long getId()</pre>", "<div class=\"block\">Comment for getId()</div>");
javaDoc = method.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
}
use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testNoJavadocMethod.
@Test
public void html_testNoJavadocMethod() throws Exception {
MavenJavaProject project = projectSupplier.get();
IType type = project.getClasspath().findType("hello.Application");
assertNotNull(type);
IMethod method = type.getMethod("corsConfigurer", Stream.empty());
assertNotNull(method);
String expected = String.join("\n", "<h4>corsConfigurer</h4>", "<pre>@Bean", "public org.springframework.web.servlet.config.annotation.WebMvcConfigurer corsConfigurer()</pre>");
IJavadoc javaDoc = method.getJavaDoc();
assertNotNull(javaDoc);
assertEquals(expected, javaDoc.getRenderable().toHtml());
}
Aggregations