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.FileTabCharacterCheck.MSG_CONTAINS_TAB;
23 import static com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck.MSG_FILE_CONTAINS_TAB;
24
25 import org.junit.jupiter.api.Test;
26
27 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
28 import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
29
30 public class FileTabCharacterExamplesTest extends AbstractExamplesModuleTestSupport {
31
32 @Override
33 public String getPackageLocation() {
34 return "com/puppycrawl/tools/checkstyle/checks/whitespace/filetabcharacter";
35 }
36
37 @Test
38 public void testExample1() throws Exception {
39 final String[] expected = {
40 "13:1: " + getCheckMessage(MSG_FILE_CONTAINS_TAB),
41 };
42
43 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
44 }
45
46 @Test
47 public void testExample2() throws Exception {
48 final String[] expected = {
49 "15:1: " + getCheckMessage(MSG_CONTAINS_TAB),
50 "17:1: " + getCheckMessage(MSG_CONTAINS_TAB),
51 };
52
53 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
54 }
55
56 @Test
57 public void testExample3() throws Exception {
58 final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
59
60 verifyWithInlineConfigParser(getPath("Example3.java"), expected);
61 }
62
63 @Test
64 public void testExample4() throws Exception {
65 final String[] expected = {
66 "13:1: " + getCheckMessage(MSG_FILE_CONTAINS_TAB),
67 };
68
69 verifyWithInlineConfigParser(getPath("Example4.xml"), expected);
70 }
71
72 @Test
73 public void testExample5() throws Exception {
74 final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
75
76 verifyWithInlineConfigParser(getPath("Example5.html"), expected);
77 }
78
79 }