use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class EmptyCatchBlockTest method emptyBlockTestCatch.
@Test
public void emptyBlockTestCatch() throws Exception {
final String[] expected = { "28: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "49: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "71: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "79: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "83: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty") };
final Configuration checkConfig = getCheckConfig("EmptyCatchBlock");
final String filePath = getPath("InputEmptyBlockCatch.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 OneStatementPerLineTest method oneStatementNonCompilableInputTest.
@Test
public void oneStatementNonCompilableInputTest() throws Exception {
final String msg = getCheckMessage(OneStatementPerLineCheck.class, "multiple.statements.line");
final String[] expected = { "32:6: " + msg, "37:58: " + msg, "38:58: " + msg, "38:74: " + msg, "39:50: " + msg, "43:91: " + msg };
final Configuration checkConfig = getCheckConfig("OneStatementPerLine");
final String filePath = new File("src/test/resources-noncompilable/" + "com/puppycrawl/tools/checkstyle/checks/coding/" + "InputOneStatementPerLine.java").getCanonicalPath();
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 OneStatementPerLineTest method oneStatementTest.
@Test
public void oneStatementTest() throws Exception {
final String msg = getCheckMessage(OneStatementPerLineCheck.class, "multiple.statements.line");
final String[] expected = { "6:59: " + msg, "50:21: " + msg, "52:21: " + msg, "54:42: " + msg, "57:25: " + msg, "58:35: " + msg, "68:14: " + msg, "95:25: " + msg, "97:25: " + msg, "99:46: " + msg, "102:29: " + msg, "103:39: " + msg, "111:15: " + msg, "123:23: " + msg, "138:59: " + msg, "170:19: " + msg, "188:15: " + msg, "196:15: " + msg, "208:6: " + msg, "217:22: " + msg, "307:39: " + msg };
final Configuration checkConfig = getCheckConfig("OneStatementPerLine");
final String filePath = getPath("InputOneStatementPerLine.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 LineLengthTest method lineLengthTest.
@Test
public void lineLengthTest() throws Exception {
final String[] expected = { "5: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 112), "29: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 113) };
final Configuration checkConfig = getCheckConfig("LineLength");
final String filePath = getPath("InputLineLength.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 MethodParamPadTest method operatorWrapTest.
@Test
public void operatorWrapTest() throws Exception {
final Class<MethodParamPadCheck> clazz = MethodParamPadCheck.class;
final String messageKeyPrevious = "line.previous";
final String messageKeyPreceded = "ws.preceded";
final String[] expected = { "83:9: " + getCheckMessage(clazz, messageKeyPrevious, "("), "128:13: " + getCheckMessage(clazz, messageKeyPrevious, "("), "130:9: " + getCheckMessage(clazz, messageKeyPrevious, "("), "353:15: " + getCheckMessage(clazz, messageKeyPreceded, "("), "358:13: " + getCheckMessage(clazz, messageKeyPrevious, "(") };
final Configuration checkConfig = getCheckConfig("MethodParamPad");
final String filePath = getPath("InputMethodParamPad.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
Aggregations