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;
21
22 import static com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck.MSG_KEY;
23
24 import org.junit.jupiter.api.Test;
25
26 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
27
28 public class FinalParametersCheckExamplesTest extends AbstractExamplesModuleTestSupport {
29
30 @Override
31 public String getPackageLocation() {
32 return "com/puppycrawl/tools/checkstyle/checks/finalparameters";
33 }
34
35 @Test
36 public void testExample1() throws Exception {
37 final String[] expected = {
38 "15:32: " + getCheckMessage(MSG_KEY, "n"),
39 "17:25: " + getCheckMessage(MSG_KEY, "x"),
40 "18:27: " + getCheckMessage(MSG_KEY, "args"),
41 };
42 verifyWithInlineConfigParser(getNonCompilablePath("Example1.java"), expected);
43 }
44
45 @Test
46 public void testExample2() throws Exception {
47 final String[] expected = {
48 "17:32: " + getCheckMessage(MSG_KEY, "n"),
49 };
50 verifyWithInlineConfigParser(getNonCompilablePath("Example2.java"), expected);
51 }
52
53 @Test
54 public void testExample3() throws Exception {
55 final String[] expected = {
56 "20:27: " + getCheckMessage(MSG_KEY, "args"),
57 };
58 verifyWithInlineConfigParser(getNonCompilablePath("Example3.java"), expected);
59 }
60
61 @Test
62 public void testExample4() throws Exception {
63 final String[] expected = {
64 "24:20: " + getCheckMessage(MSG_KEY, "e"),
65 "30:10: " + getCheckMessage(MSG_KEY, "number"),
66 };
67 verifyWithInlineConfigParser(
68 getNonCompilablePath("Example4.java"), expected);
69 }
70
71 }