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.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck.MSG_MISSING_TAG;
23 import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck.MSG_UNKNOWN_TAG;
24
25 import org.junit.jupiter.api.Test;
26
27 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
28
29 public class JavadocTypeCheckExamplesTest extends AbstractExamplesModuleTestSupport {
30 @Override
31 protected String getPackageLocation() {
32 return "com/puppycrawl/tools/checkstyle/checks/javadoc/javadoctype";
33 }
34
35 @Test
36 public void testExample1() throws Exception {
37 final String[] expected = {
38 "28:6: " + getCheckMessage(MSG_UNKNOWN_TAG, "unknownTag"),
39 "36:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
40 "39:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
41 };
42
43 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
44 }
45
46 @Test
47 public void testExample2() throws Exception {
48 final String[] expected = {
49 "30:6: " + getCheckMessage(MSG_UNKNOWN_TAG, "unknownTag"),
50 "38:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
51 };
52
53 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
54 }
55
56 @Test
57 public void testExample3() throws Exception {
58 final String[] expected = {
59 "30:6: " + getCheckMessage(MSG_UNKNOWN_TAG, "unknownTag"),
60 "38:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
61 "41:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
62 };
63
64 verifyWithInlineConfigParser(getPath("Example3.java"), expected);
65 }
66
67 @Test
68 public void testExample4() throws Exception {
69 final String[] expected = {
70 "30:6: " + getCheckMessage(MSG_UNKNOWN_TAG, "unknownTag"),
71 "38:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
72 "41:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
73
74 };
75
76 verifyWithInlineConfigParser(getPath("Example4.java"), expected);
77 }
78
79 @Test
80 public void testExample5() throws Exception {
81 final String[] expected = {
82 "42:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
83 };
84
85 verifyWithInlineConfigParser(getPath("Example5.java"), expected);
86 }
87
88 @Test
89 public void testExample6() throws Exception {
90 final String[] expected = {
91 "30:6: " + getCheckMessage(MSG_UNKNOWN_TAG, "unknownTag"),
92 };
93
94 verifyWithInlineConfigParser(getPath("Example6.java"), expected);
95 }
96
97 @Test
98 public void testExample7() throws Exception {
99 final String[] expected = {
100 "38:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
101 "41:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
102 };
103
104 verifyWithInlineConfigParser(getPath("Example7.java"), expected);
105 }
106
107 @Test
108 public void testExample8() throws Exception {
109 final String[] expected = {
110 "30:6: " + getCheckMessage(MSG_UNKNOWN_TAG, "unknownTag"),
111 "38:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
112 "41:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
113 "44:3: " + getCheckMessage(MSG_MISSING_TAG, "@param <T>"),
114 };
115
116 verifyWithInlineConfigParser(getPath("Example8.java"), expected);
117 }
118 }