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