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;
21
22 import static com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck.MSG_KEY;
23
24 import org.junit.jupiter.api.Test;
25
26 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
27
28 public class AvoidEscapedUnicodeCharactersCheckExamplesTest
29 extends AbstractExamplesModuleTestSupport {
30 @Override
31 protected String getPackageLocation() {
32 return "com/puppycrawl/tools/checkstyle/checks/avoidescapedunicodecharacters";
33 }
34
35 @Test
36 public void testExample1() throws Exception {
37 final String[] expected = {
38 "16:24: " + getCheckMessage(MSG_KEY),
39 "18:24: " + getCheckMessage(MSG_KEY),
40 "20:24: " + getCheckMessage(MSG_KEY),
41 "22:24: " + getCheckMessage(MSG_KEY),
42 "26:12: " + getCheckMessage(MSG_KEY),
43 };
44
45 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
46 }
47
48 @Test
49 public void testExample2() throws Exception {
50 final String[] expected = {
51 "18:24: " + getCheckMessage(MSG_KEY),
52 "20:24: " + getCheckMessage(MSG_KEY),
53 "22:24: " + getCheckMessage(MSG_KEY),
54 "24:24: " + getCheckMessage(MSG_KEY),
55 };
56
57 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
58 }
59
60 @Test
61 public void testExample3() throws Exception {
62 final String[] expected = {
63 "18:24: " + getCheckMessage(MSG_KEY),
64 "20:24: " + getCheckMessage(MSG_KEY),
65 "22:24: " + getCheckMessage(MSG_KEY),
66 "28:12: " + getCheckMessage(MSG_KEY),
67 };
68
69 verifyWithInlineConfigParser(getPath("Example3.java"), expected);
70 }
71
72 @Test
73 public void testExample4() throws Exception {
74 final String[] expected = {
75 "18:24: " + getCheckMessage(MSG_KEY),
76 "22:24: " + getCheckMessage(MSG_KEY),
77 "24:24: " + getCheckMessage(MSG_KEY),
78 };
79
80 verifyWithInlineConfigParser(getPath("Example4.java"), expected);
81 }
82
83 @Test
84 public void testExample5() throws Exception {
85 final String[] expected = {
86 "18:24: " + getCheckMessage(MSG_KEY, "unitAbbrev1"),
87 "20:24: " + getCheckMessage(MSG_KEY),
88 "22:24: " + getCheckMessage(MSG_KEY),
89 "24:24: " + getCheckMessage(MSG_KEY),
90 };
91
92 verifyWithInlineConfigParser(getPath("Example5.java"), expected);
93 }
94 }