@Test public void testEmbeddedAnnotationsInAnnotations() { Map<String, SmartComment.Replacement> reps = new HashMap<String, SmartComment.Replacement>(); reps.put( "code", new SmartComment.Replacement() { @Override public String replace(String data) { return "<code>" + data + "</code>"; } }); SmartComment c = new SmartComment( "/**\n" + " * {@code code}\n" + " * {@unknown text}\n" + " * @param one {@code code}\n" + " * @param two\n" + " */", reps); assertTrue(c.getAnnotations("param").contains("one <code>code</code>")); assertTrue(c.getAnnotations("param").contains("two")); assertTrue(c.getAnnotations("param").size() == 2); assertEquals("<code>code</code>\ntext", c.getBody()); }
@Test public void testSimpleFormatting() { SmartComment c = new SmartComment("/**\n" + " * This is a comment\n" + " * with a newline \n" + " */"); assertEquals("This is a comment\nwith a newline", c.getBody()); }
@Test public void testSimple() { SmartComment c = new SmartComment("/**\n" + " * This is a comment\n" + " */"); assertEquals("This is a comment", c.getBody()); }