Search in sources :

Example 1 with OperatorWrapCheck

use of com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck in project checkstyle by checkstyle.

the class OperatorWrapTest method operatorWrapTest.

@Test
public void operatorWrapTest() throws Exception {
    final Class<OperatorWrapCheck> clazz = OperatorWrapCheck.class;
    final String messageKey = "line.new";
    final String[] expected = { "11:27: " + getCheckMessage(clazz, messageKey, "+"), "12:28: " + getCheckMessage(clazz, messageKey, "-"), "20:27: " + getCheckMessage(clazz, messageKey, "&&"), "62:42: " + getCheckMessage(clazz, messageKey, "?"), "66:27: " + getCheckMessage(clazz, messageKey, "!="), "72:30: " + getCheckMessage(clazz, messageKey, "=="), "78:27: " + getCheckMessage(clazz, messageKey, ">"), "84:35: " + getCheckMessage(clazz, messageKey, "||"), "107:46: " + getCheckMessage(clazz, messageKey, "?"), "111:31: " + getCheckMessage(clazz, messageKey, "!="), "117:34: " + getCheckMessage(clazz, messageKey, "=="), "123:31: " + getCheckMessage(clazz, messageKey, ">"), "129:39: " + getCheckMessage(clazz, messageKey, "||"), "153:46: " + getCheckMessage(clazz, messageKey, "?"), "157:31: " + getCheckMessage(clazz, messageKey, "!="), "163:34: " + getCheckMessage(clazz, messageKey, "=="), "169:31: " + getCheckMessage(clazz, messageKey, ">"), "175:39: " + getCheckMessage(clazz, messageKey, "||"), "194:38: " + getCheckMessage(clazz, messageKey, "?") };
    final Configuration checkConfig = getCheckConfig("OperatorWrap");
    final String filePath = getPath("InputOperatorWrap.java");
    final Integer[] warnList = getLinesWithWarn(filePath);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) OperatorWrapCheck(com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck) Test(org.junit.Test)

Example 2 with OperatorWrapCheck

use of com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck in project checkstyle by checkstyle.

the class OperatorWrapTest method testOperatorWrap.

@Test
public void testOperatorWrap() throws Exception {
    final Class<OperatorWrapCheck> clazz = OperatorWrapCheck.class;
    final String messageKey = "line.new";
    final String[] expected = { "11:27: " + getCheckMessage(clazz, messageKey, "+"), "12:28: " + getCheckMessage(clazz, messageKey, "-"), "20:27: " + getCheckMessage(clazz, messageKey, "&&"), "28:33: " + getCheckMessage(clazz, messageKey, "::"), "43:35: " + getCheckMessage(clazz, messageKey, "&"), "62:42: " + getCheckMessage(clazz, messageKey, "?"), "66:27: " + getCheckMessage(clazz, messageKey, "!="), "72:30: " + getCheckMessage(clazz, messageKey, "=="), "78:27: " + getCheckMessage(clazz, messageKey, ">"), "84:35: " + getCheckMessage(clazz, messageKey, "||"), "107:46: " + getCheckMessage(clazz, messageKey, "?"), "111:31: " + getCheckMessage(clazz, messageKey, "!="), "117:34: " + getCheckMessage(clazz, messageKey, "=="), "123:31: " + getCheckMessage(clazz, messageKey, ">"), "129:39: " + getCheckMessage(clazz, messageKey, "||"), "153:46: " + getCheckMessage(clazz, messageKey, "?"), "157:31: " + getCheckMessage(clazz, messageKey, "!="), "163:34: " + getCheckMessage(clazz, messageKey, "=="), "169:31: " + getCheckMessage(clazz, messageKey, ">"), "175:39: " + getCheckMessage(clazz, messageKey, "||"), "194:38: " + getCheckMessage(clazz, messageKey, "?") };
    final Configuration checkConfig = getModuleConfig("OperatorWrap");
    final String filePath = getPath("InputOperatorWrap.java");
    final Integer[] warnList = getLinesWithWarn(filePath);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) OperatorWrapCheck(com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck) Test(org.junit.jupiter.api.Test)

Aggregations

Configuration (com.puppycrawl.tools.checkstyle.api.Configuration)2 OperatorWrapCheck (com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck)2 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1