use of com.puppycrawl.tools.checkstyle.api.Configuration 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);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class SeparatorWrapTest method separatorWrapCommaTest.
@Test
public void separatorWrapCommaTest() throws Exception {
final String[] expected = { "31:17: " + getCheckMessage(SeparatorWrapCheck.class, "line.previous", ",") };
final Configuration checkConfig = getCheckConfig("SeparatorWrap", "SeparatorWrapComma");
final String filePath = getPath("InputSeparatorWrapComma.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class AvoidStarImportTest method starImportTest.
@Test
public void starImportTest() throws Exception {
final String[] expected = { "3: Using the '.*' form of import should be avoided - java.io.*.", "4: Using the '.*' form of import should be avoided - java.lang.*.", "18: Using the '.*' form of import should be avoided - javax.swing.WindowConstants.*.", "19: Using the '.*' form of import should be avoided - javax.swing.WindowConstants.*." };
final Configuration checkConfig = getCheckConfig("AvoidStarImport");
final String filePath = getPath("InputAvoidStarImport.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class NoLineWrapTest method badLineWrapTest.
@Test
public void badLineWrapTest() throws Exception {
final String[] expected = { "1: " + getCheckMessage(NoLineWrapCheck.class, "no.line.wrap", "package"), "6: " + getCheckMessage(NoLineWrapCheck.class, "no.line.wrap", "import") };
final Configuration checkConfig = getCheckConfig("NoLineWrap");
final String filePath = getPath("InputNoLineWrapBad.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class NoLineWrapTest method goodLineWrapTest.
@Test
public void goodLineWrapTest() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
final Configuration checkConfig = getCheckConfig("NoLineWrap");
final String filePath = getPath("InputNoLineWrapGood.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
Aggregations