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 static com.google.common.truth.Truth.assertWithMessage;
23 import static com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanExpressionCheck.MSG_KEY;
24
25 import org.junit.jupiter.api.Test;
26
27 import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
28
29 public class SimplifyBooleanExpressionCheckTest
30 extends AbstractModuleTestSupport {
31
32 @Override
33 protected String getPackageLocation() {
34 return "com/puppycrawl/tools/checkstyle/checks/coding/simplifybooleanexpression";
35 }
36
37 @Test
38 public void testIt() throws Exception {
39 final String[] expected = {
40 "22:18: " + getCheckMessage(MSG_KEY),
41 "43:36: " + getCheckMessage(MSG_KEY),
42 "44:36: " + getCheckMessage(MSG_KEY),
43 "45:16: " + getCheckMessage(MSG_KEY),
44 "45:32: " + getCheckMessage(MSG_KEY),
45 "95:27: " + getCheckMessage(MSG_KEY),
46 "96:24: " + getCheckMessage(MSG_KEY),
47 "98:27: " + getCheckMessage(MSG_KEY),
48 "104:23: " + getCheckMessage(MSG_KEY),
49 "106:17: " + getCheckMessage(MSG_KEY),
50 "109:21: " + getCheckMessage(MSG_KEY),
51 "110:23: " + getCheckMessage(MSG_KEY),
52 "111:20: " + getCheckMessage(MSG_KEY),
53 };
54 verifyWithInlineConfigParser(
55 getPath("InputSimplifyBooleanExpression.java"), expected);
56 }
57
58 @Test
59 public void testTokensNotNull() {
60 final SimplifyBooleanExpressionCheck check = new SimplifyBooleanExpressionCheck();
61 assertWithMessage("Acceptable tokens should not be null")
62 .that(check.getAcceptableTokens())
63 .isNotNull();
64 assertWithMessage("Default tokens should not be null")
65 .that(check.getDefaultTokens())
66 .isNotNull();
67 assertWithMessage("Required tokens should not be null")
68 .that(check.getRequiredTokens())
69 .isNotNull();
70 }
71
72 }