Search in sources :

Example 1 with BlockComment

use of com.google.api.generator.engine.ast.BlockComment in project gapic-generator-java by googleapis.

the class JavaWriterVisitorTest method writeBlockComment_shortLines.

@Test
public void writeBlockComment_shortLines() {
    String content = "Apache License \nThis is a test file header";
    BlockComment blockComment = BlockComment.builder().setComment(content).build();
    String expected = LineFormatter.lines("/*\n", "* Apache License\n", "* This is a test file header\n", "*/\n");
    blockComment.accept(writerVisitor);
    assertEquals(expected, writerVisitor.write());
}
Also used : BlockComment(com.google.api.generator.engine.ast.BlockComment) Test(org.junit.Test)

Example 2 with BlockComment

use of com.google.api.generator.engine.ast.BlockComment in project gapic-generator-java by googleapis.

the class JavaWriterVisitorTest method writeBlockCommentStatement_basic.

/**
 * =============================== COMMENT ===============================
 */
@Test
public void writeBlockCommentStatement_basic() {
    String content = "this is a test comment";
    BlockComment blockComment = BlockComment.builder().setComment(content).build();
    CommentStatement commentStatement = CommentStatement.withComment(blockComment);
    String expected = LineFormatter.lines("/*\n", "* this is a test comment\n", "*/\n");
    commentStatement.accept(writerVisitor);
    assertEquals(expected, writerVisitor.write());
}
Also used : BlockComment(com.google.api.generator.engine.ast.BlockComment) CommentStatement(com.google.api.generator.engine.ast.CommentStatement) Test(org.junit.Test)

Example 3 with BlockComment

use of com.google.api.generator.engine.ast.BlockComment in project gapic-generator-java by googleapis.

the class JavaWriterVisitorTest method writeBlockComment_newLineInBetween.

@Test
public void writeBlockComment_newLineInBetween() {
    String content = "Apache License \n" + "Licensed under the Apache License, Version 2.0 (the \"License\");\n\n" + "you may not use this file except in compliance with the License.";
    BlockComment blockComment = BlockComment.builder().setComment(content).build();
    String expected = LineFormatter.lines("/*\n", "* Apache License\n", "* Licensed under the Apache License, Version 2.0 (the \"License\");\n", "*\n", "* you may not use this file except in compliance with the License.\n", "*/\n");
    blockComment.accept(writerVisitor);
    assertEquals(expected, writerVisitor.write());
}
Also used : BlockComment(com.google.api.generator.engine.ast.BlockComment) Test(org.junit.Test)

Aggregations

BlockComment (com.google.api.generator.engine.ast.BlockComment)3 Test (org.junit.Test)3 CommentStatement (com.google.api.generator.engine.ast.CommentStatement)1