Skip to content

Commit

Permalink
ROASTER-59: Fixed multi-line javadoc parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Sep 28, 2015
1 parent 0e7fe81 commit 7dafd40
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,16 @@ public String getFullText()
for (TagElement tagElement : tagList)
{
if (tagElement.getTagName() != null)
{
text.append(tagElement.getTagName());
for (Object fragment : tagElement.fragments())
}
List<Object> fragments = tagElement.fragments();
for (Iterator<Object> iterator = fragments.iterator(); iterator.hasNext();)
{
Object fragment = iterator.next();
text.append(fragment);
if (iterator.hasNext())
text.append(' ');
}
text.append(System.getProperty("line.separator"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,17 @@ public void testJavaDocEnumConstant() throws Exception
Assert.assertEquals(expected, javaDoc.getFullText());
}

@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());
}
}

0 comments on commit 7dafd40

Please sign in to comment.