@Test public void testJavaDocMultiLineShouldNotConcatenateWords() throws Exception { String text = "/**" + LINE_SEPARATOR + "* The country where this currency is used mostly. This field is just for" + LINE_SEPARATOR + "* informational purposes and have no effect on any processing." + LINE_SEPARATOR + "*/" + LINE_SEPARATOR + "public class MyClass{}"; JavaClassSource javaClass = Roaster.parse(JavaClassSource.class, text); JavaDocSource<JavaClassSource> javaDoc = javaClass.getJavaDoc(); String expected = "The country where this currency is used mostly. This field is just for informational purposes and have no effect on any processing."; Assert.assertEquals(expected, javaDoc.getFullText()); }
@Test public void testJavaDocEnumConstant() throws Exception { String text = "public enum MyEnum {" + "/**" + LINE_SEPARATOR + " * Do Something" + LINE_SEPARATOR + " * @author George Gastaldi" + LINE_SEPARATOR + " */" + LINE_SEPARATOR + "" + "MY_CONSTANT;}"; JavaEnumSource javaEnum = Roaster.parse(JavaEnumSource.class, text); Assert.assertFalse(javaEnum.hasJavaDoc()); EnumConstantSource enumConstant = javaEnum.getEnumConstant("MY_CONSTANT"); Assert.assertTrue(enumConstant.hasJavaDoc()); JavaDocSource<EnumConstantSource> javaDoc = enumConstant.getJavaDoc(); String expected = "Do Something" + LINE_SEPARATOR + "@author George Gastaldi"; Assert.assertEquals(expected, javaDoc.getFullText()); }
@Test public void testJavaDocGetFullText() throws Exception { String text = "/**" + LINE_SEPARATOR + " * Do Something" + LINE_SEPARATOR + " * @author George Gastaldi" + LINE_SEPARATOR + " */" + LINE_SEPARATOR + "public class MyClass" + LINE_SEPARATOR + "{" + LINE_SEPARATOR + "}"; JavaClassSource javaClass = Roaster.parse(JavaClassSource.class, text); Assert.assertTrue(javaClass.hasJavaDoc()); JavaDocSource<JavaClassSource> javaDoc = javaClass.getJavaDoc(); String expected = "Do Something" + LINE_SEPARATOR + "@author George Gastaldi"; Assert.assertEquals(expected, javaDoc.getFullText()); }