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 org.junit.jupiter.api.Test;
23
24 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
25
26 public class ConstructorsDeclarationGroupingCheckExamplesTest
27 extends AbstractExamplesModuleTestSupport {
28 @Override
29 public String getPackageLocation() {
30 return "com/puppycrawl/tools/checkstyle/checks/coding/constructorsdeclarationgrouping";
31 }
32
33 @Test
34 public void testExample1() throws Exception {
35 final String[] expected = {
36 "27:3: " + getCheckMessage(ConstructorsDeclarationGroupingCheck.MSG_KEY, 21),
37 "39:5: " + getCheckMessage(ConstructorsDeclarationGroupingCheck.MSG_KEY, 33),
38 "43:5: " + getCheckMessage(ConstructorsDeclarationGroupingCheck.MSG_KEY, 33),
39 };
40
41 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
42 }
43
44 @Test
45 public void testExample2() throws Exception {
46 final String[] expected = {
47 "21:3: " + getCheckMessage(ConstructorsDeclarationGroupingCheck.MSG_ORDER),
48 "27:3: " + getCheckMessage(ConstructorsDeclarationGroupingCheck.MSG_KEY, 21),
49 "27:3: " + getCheckMessage(ConstructorsDeclarationGroupingCheck.MSG_ORDER),
50 "39:5: " + getCheckMessage(ConstructorsDeclarationGroupingCheck.MSG_KEY, 33),
51 "43:5: " + getCheckMessage(ConstructorsDeclarationGroupingCheck.MSG_KEY, 33),
52 };
53
54 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
55 }
56 }