use of com.sun.tools.javadoc.JavadocTool in project checkstyle by checkstyle.
the class TokenTypesDocletTest method testNotConstants.
@Test
public void testNotConstants() throws Exception {
// Token types must be public int constants, which means that they must have
// modifiers public, static, final and type int, because they are referenced statically in
// a lot of different places, must not be changed and an int value is used to encrypt
// a token type.
final ListBuffer<String[]> options = new ListBuffer<>();
options.add(new String[] { "-doclet", "TokenTypesDoclet" });
options.add(new String[] { "-destfile", "target/tokentypes.properties" });
final ListBuffer<String> names = new ListBuffer<>();
names.add(getPath("InputTokenTypesDocletNotConstants.java"));
final Context context = new Context();
new TestMessager(context);
final JavadocTool javadocTool = JavadocTool.make0(context);
final RootDoc rootDoc = getRootDoc(javadocTool, options, names);
assertTrue(TokenTypesDoclet.start(rootDoc));
}
use of com.sun.tools.javadoc.JavadocTool in project checkstyle by checkstyle.
the class TokenTypesDocletTest method testCorrect.
@Test
public void testCorrect() throws Exception {
final ListBuffer<String[]> options = new ListBuffer<>();
options.add(new String[] { "-destfile", "target/tokentypes.properties" });
final ListBuffer<String> names = new ListBuffer<>();
names.add(getPath("InputTokenTypesDocletCorrect.java"));
final Context context = new Context();
new TestMessager(context);
final JavadocTool javadocTool = JavadocTool.make0(context);
final RootDoc rootDoc = getRootDoc(javadocTool, options, names);
assertTrue(TokenTypesDoclet.start(rootDoc));
}
use of com.sun.tools.javadoc.JavadocTool in project checkstyle by checkstyle.
the class TokenTypesDocletTest method testEmptyJavadoc.
@Test
public void testEmptyJavadoc() throws Exception {
final ListBuffer<String[]> options = new ListBuffer<>();
options.add(new String[] { "-destfile", "target/tokentypes.properties" });
final ListBuffer<String> names = new ListBuffer<>();
names.add(getPath("InputTokenTypesDocletEmptyJavadoc.java"));
final Context context = new Context();
new TestMessager(context);
final JavadocTool javadocTool = JavadocTool.make0(context);
final RootDoc rootDoc = getRootDoc(javadocTool, options, names);
try {
TokenTypesDoclet.start(rootDoc);
fail("IllegalArgumentException is expected");
} catch (IllegalArgumentException expected) {
// Token types must have first sentence of Javadoc summary
// so that a brief description could be provided. Otherwise,
// an IllegalArgumentException is thrown.
}
}
Aggregations