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.coding;
21
22 import static com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.MSG_ACCESS;
23 import static com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.MSG_CONSTRUCTOR;
24 import static com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.MSG_INSTANCE;
25
26 import org.junit.jupiter.api.Test;
27
28 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
29
30 public class DeclarationOrderCheckExamplesTest extends AbstractExamplesModuleTestSupport {
31
32 @Override
33 public String getPackageLocation() {
34 return "com/puppycrawl/tools/checkstyle/checks/coding/declarationorder";
35 }
36
37 @Test
38 public void testExample1() throws Exception {
39 final String[] expected = {
40 "16:3: " + getCheckMessage(MSG_ACCESS),
41 "26:3: " + getCheckMessage(MSG_CONSTRUCTOR),
42 "30:3: " + getCheckMessage(MSG_INSTANCE),
43 };
44
45 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
46 }
47
48 @Test
49 public void testExample2() throws Exception {
50 final String[] expected = {
51 "18:3: " + getCheckMessage(MSG_ACCESS),
52 "32:3: " + getCheckMessage(MSG_INSTANCE),
53 };
54
55 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
56 }
57
58 @Test
59 public void testExample3() throws Exception {
60 final String[] expected = {
61 "28:3: " + getCheckMessage(MSG_CONSTRUCTOR),
62 "32:3: " + getCheckMessage(MSG_INSTANCE),
63 };
64
65 verifyWithInlineConfigParser(getPath("Example3.java"), expected);
66 }
67
68 }