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.AvoidInlineConditionalsCheck.MSG_KEY;
24
25 import org.junit.jupiter.api.Test;
26
27 import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
28
29 public class AvoidInlineConditionalsCheckTest
30 extends AbstractModuleTestSupport {
31
32 @Override
33 protected String getPackageLocation() {
34 return "com/puppycrawl/tools/checkstyle/checks/coding/avoidinlineconditionals";
35 }
36
37 @Test
38 public void testDefault()
39 throws Exception {
40 final String[] expected = {
41 "34:29: " + getCheckMessage(MSG_KEY),
42 "35:20: " + getCheckMessage(MSG_KEY),
43 "48:34: " + getCheckMessage(MSG_KEY),
44 };
45 verifyWithInlineConfigParser(
46 getPath("InputAvoidInlineConditionals.java"), expected);
47 }
48
49 @Test
50 public void testTokensNotNull() {
51 final AvoidInlineConditionalsCheck check = new AvoidInlineConditionalsCheck();
52 assertWithMessage("Acceptable tokens should not be null")
53 .that(check.getAcceptableTokens())
54 .isNotNull();
55 assertWithMessage("Default tokens should not be null")
56 .that(check.getDefaultTokens())
57 .isNotNull();
58 assertWithMessage("Required tokens should not be null")
59 .that(check.getRequiredTokens())
60 .isNotNull();
61 }
62
63 }