View Javadoc

    1   /**
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package net.sourceforge.pmd.lang.java.rule.comments;
    5
    6   import static org.junit.Assert.assertEquals;
    7   import net.sourceforge.pmd.lang.java.ast.FormalComment;
    8   import net.sourceforge.pmd.lang.java.ast.MultiLineComment;
    9   import net.sourceforge.pmd.lang.java.ast.Token;
    10
    11  import org.junit.Test;
    12
    13  public class AbstractCommentRuleTest {
    14
    15  	private AbstractCommentRule testSubject = new AbstractCommentRule() {};
    16
    17  	/**
    18  	 * Blank lines in comments should not raise an exception.
    19  	 * See bug #1048.
    20  	 */
    21  	@Test
    22  	public void testFilteredCommentIn() {
    23  		Token token = new Token();
    24  		token.image = "/* multi line comment with blank lines\n\n\n */";
    25
    26  		String filtered = testSubject.filteredCommentIn(new MultiLineComment(token));
    27  		assertEquals("multi line comment with blank lines", filtered);
    28
    29  		token.image = "/** a formal comment with blank lines\n\n\n */";
    30  		filtered = testSubject.filteredCommentIn(new FormalComment(token));
    31  		assertEquals("a formal comment with blank lines", filtered);
    32  	}
    33
    34  }