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.JavadocVariableCheck.MSG_JAVADOC_MISSING;
23
24 import org.junit.jupiter.api.Test;
25
26 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
27
28 public class MissingJavadocMethodCheckExamplesTest extends AbstractExamplesModuleTestSupport {
29 @Override
30 protected String getPackageLocation() {
31 return "com/puppycrawl/tools/checkstyle/checks/javadoc/missingjavadocmethod";
32 }
33
34 @Test
35 public void testExample1() throws Exception {
36 final String[] expected = {
37 "12:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
38 "13:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
39 };
40
41 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
42 }
43
44 @Test
45 public void testExample2() throws Exception {
46 final String[] expected = {
47 "14:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
48 "15:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
49 "26:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
50 "27:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
51 "28:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
52 };
53
54 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
55 }
56
57 @Test
58 public void testExample3() throws Exception {
59 final String[] expected = {
60 "15:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
61 "16:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
62 "27:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
63 "29:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
64 };
65
66 verifyWithInlineConfigParser(getPath("Example3.java"), expected);
67 }
68
69 @Test
70 public void testExample4() throws Exception {
71 final String[] expected = {
72 "14:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
73 };
74
75 verifyWithInlineConfigParser(getPath("Example4.java"), expected);
76 }
77
78 @Test
79 public void testExample5() throws Exception {
80 final String[] expected = {
81 "14:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
82 "15:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
83 };
84
85 verifyWithInlineConfigParser(getPath("Example5.java"), expected);
86 }
87
88 @Test
89 public void testExample6() throws Exception {
90 final String[] expected = {
91 "14:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
92 "15:3: " + getCheckMessage(MSG_JAVADOC_MISSING),
93 };
94
95 verifyWithInlineConfigParser(getPath("Example6.java"), expected);
96 }
97 }