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