Exemplo n.º 1
0
 @Test
 public void testJavaDocParsing() throws Exception {
   String text = "/** Text */ public class MyClass{}";
   JavaClassSource javaClass = Roaster.parse(JavaClassSource.class, text);
   JavaDocSource<JavaClassSource> javaDoc = javaClass.getJavaDoc();
   Assert.assertNotNull(javaDoc);
   Assert.assertEquals("Text", javaDoc.getText());
   Assert.assertTrue(javaDoc.getTagNames().isEmpty());
 }
Exemplo n.º 2
0
 @Test
 public void testJavaDocParsingTags() throws Exception {
   String text = "/** Do Something\n*@author George Gastaldi*/ public class MyClass{}";
   JavaClassSource javaClass = Roaster.parse(JavaClassSource.class, text);
   JavaDocSource<JavaClassSource> javaDoc = javaClass.getJavaDoc();
   Assert.assertNotNull(javaDoc);
   Assert.assertEquals("Do Something", javaDoc.getText());
   Assert.assertEquals(1, javaDoc.getTagNames().size());
   JavaDocTag authorTag = javaDoc.getTags("@author").get(0);
   Assert.assertEquals("@author", authorTag.getName());
   Assert.assertEquals("George Gastaldi", authorTag.getValue());
 }