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.whitespace;
21
22 import static com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck.MSG_LINE_NEW;
23 import static com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck.MSG_LINE_PREVIOUS;
24
25 import org.junit.jupiter.api.Test;
26
27 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
28
29 public class SeparatorWrapExamplesTest extends AbstractExamplesModuleTestSupport {
30
31 @Override
32 public String getPackageLocation() {
33 return "com/puppycrawl/tools/checkstyle/checks/whitespace/separatorwrap";
34 }
35
36 @Test
37 public void testExample1() throws Exception {
38 final String[] expected = {
39 "27:11: " + getCheckMessage(MSG_LINE_PREVIOUS, ","),
40 "29:13: " + getCheckMessage(MSG_LINE_PREVIOUS, "."),
41 };
42
43 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
44 }
45
46 @Test
47 public void testExample2() throws Exception {
48 final String[] expected = {
49 "13:15: " + getCheckMessage(MSG_LINE_NEW, "."),
50 "19:8: " + getCheckMessage(MSG_LINE_NEW, ","),
51 "22:17: " + getCheckMessage(MSG_LINE_NEW, ","),
52 };
53
54 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
55 }
56
57 @Test
58 public void testExample3() throws Exception {
59 final String[] expected = {
60 "22:8: " + getCheckMessage(MSG_LINE_NEW, ","),
61 "25:17: " + getCheckMessage(MSG_LINE_NEW, ","),
62 };
63
64 verifyWithInlineConfigParser(getPath("Example3.java"), expected);
65 }
66
67 @Test
68 public void testUseCase1() throws Exception {
69 final String[] expected = {
70 "23:36: " + getCheckMessage(MSG_LINE_NEW, "::"),
71 };
72
73 verifyWithInlineConfigParser(getPath("UseCase1.java"), expected);
74 }
75
76 }