1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.puppycrawl.tools.checkstyle.checks.javadoc;
21
22 import static com.google.common.truth.Truth.assertWithMessage;
23
24 import org.junit.jupiter.api.Test;
25
26 import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes;
27
28 public class JavadocNodeImplTest {
29
30 @Test
31 public void testToString() {
32 final JavadocNodeImpl javadocNode = new JavadocNodeImpl();
33 javadocNode.setType(JavadocTokenTypes.CODE_LITERAL);
34 javadocNode.setLineNumber(1);
35 javadocNode.setColumnNumber(2);
36
37 final String result = javadocNode.toString();
38
39 assertWithMessage("Invalid toString result")
40 .that(result)
41 .isEqualTo("JavadocNodeImpl[index=0, type=CODE_LITERAL, text='null', lineNumber=1,"
42 + " columnNumber=2, children=0, parent=null]");
43 }
44
45 @Test
46 public void testGetColumnNumber() {
47 final JavadocNodeImpl javadocNode = new JavadocNodeImpl();
48 javadocNode.setColumnNumber(1);
49
50 final int result = javadocNode.getColumnNumber();
51
52 assertWithMessage("Invalid column number")
53 .that(result)
54 .isEqualTo(1);
55 }
56
57 }