DataServiceVisitorJsBuilder extends AbstractDataServiceVisitor { void writeJavadocComment(String methodComment, Writer writer) throws IOException { if (methodComment != null) { methodComment = methodComment.split("@")[0]; int lastIndexOf = methodComment.lastIndexOf("\n"); if (lastIndexOf >= 0) { methodComment = methodComment.substring(0, lastIndexOf); } String comment = methodComment.replaceAll("\n", CR+TAB2+" *"); writer.append(TAB2).append(" *").append(comment).append(CR); } } DataServiceVisitorJsBuilder(ProcessingEnvironment environment, FwkWriter fwk);   }
@Test public void writeJavadocCommentTest() throws IOException { System.out.println("writeJavadocComment"); Writer writer = new StringWriter(); String methodComment = ""; instance.writeJavadocComment(methodComment, writer); assertThat(writer.toString()).isEqualTo(TAB2+" *"+CR); writer = new StringWriter(); instance.writeJavadocComment(" method do that\n@param a", writer); assertThat(writer.toString()).isEqualTo(TAB2+" * method do that"+CR); writer = new StringWriter(); instance.writeJavadocComment(" method do that\n and that\n@param a", writer); assertThat(writer.toString()).isEqualTo(TAB2+" * method do that"+CR+TAB2+" * and that"+CR); }