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.sizes;
21
22 import org.junit.jupiter.api.Test;
23
24 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
25
26 public class RecordComponentNumberCheckExamplesTest extends AbstractExamplesModuleTestSupport {
27 @Override
28 protected String getPackageLocation() {
29 return "com/puppycrawl/tools/checkstyle/checks/sizes/recordcomponentnumber";
30 }
31
32 @Test
33 public void testExample1() throws Exception {
34 final String[] expected = {
35 "19:3: " + getCheckMessage(RecordComponentNumberCheck.MSG_KEY, 9, 8),
36 };
37
38 verifyWithInlineConfigParser(
39 getNonCompilablePath("Example1.java"), expected);
40 }
41
42 @Test
43 public void testExample2() throws Exception {
44 final String[] expected = {
45 "18:3: " + getCheckMessage(RecordComponentNumberCheck.MSG_KEY, 6, 5),
46 "21:3: " + getCheckMessage(RecordComponentNumberCheck.MSG_KEY, 9, 5),
47 };
48
49 verifyWithInlineConfigParser(
50 getNonCompilablePath("Example2.java"), expected);
51 }
52
53 @Test
54 public void testExample3() throws Exception {
55 final String[] expected = {
56 "23:3: " + getCheckMessage(RecordComponentNumberCheck.MSG_KEY, 6, 5),
57 "29:3: " + getCheckMessage(RecordComponentNumberCheck.MSG_KEY, 4, 3),
58 };
59
60 verifyWithInlineConfigParser(
61 getNonCompilablePath("Example3.java"), expected);
62 }
63 }