use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class IndentationTest method correctIfTest.
@Test
public void correctIfTest() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
final Configuration checkConfig = getCheckConfig("Indentation");
final String filePath = getPath("InputIndentationCorrectIfAndParameter.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 AnnotationLocationTest method annotationTestVariables.
@Test
public void annotationTestVariables() throws Exception {
final Class<AnnotationLocationCheck> clazz = AnnotationLocationCheck.class;
getCheckMessage(clazz, "annotation.location.alone");
final Configuration checkConfig = getCheckConfig("AnnotationLocation", "AnnotationLocationVariables");
final String msgLocation = "annotation.location";
final String[] expected = { "63: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "7", "4") };
final String filePath = getPath("InputAnnotationLocationVariables.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 CommentsIndentationTest method testSurroundingCode.
@Test
public void testSurroundingCode() throws Exception {
final String[] expected = { "13: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 14, 14, 12), "23: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.block", 24, 16, 12), "25: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.block", 27, 16, 12), "28: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.block", 31, 16, 12), "50: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 53, 27, 36), "51: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.block", 53, 23, 36), "90: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 91, 14, 8), "98: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 100, 13, 8), "108: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 109, 33, 8) };
final Configuration checkConfig = getCheckConfig("CommentsIndentation");
final String filePath = getPath("InputCommentsIndentationSurroundingCode.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 CommentsIndentationTest method testCommentIsInsideSwitchBlock.
@Test
public void testCommentIsInsideSwitchBlock() throws Exception {
final String[] expected = { "19: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.block", 20, 12, 16), "25: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "24, 26", 19, "16, 12"), "31: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "30, 32", 19, "16, 12"), "48: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 49, 6, 16), "55: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 56, 8, 12), "59: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 58, 22, 16), "68: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "65, 69", 14, "12, 16"), "88: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 89, 24, 20), "113: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "112, 114", 15, "17, 12"), "125: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 126, 8, 12), "138: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 139, 4, 8), "157: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "156, 158", 18, "16, 12"), "200: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "199, 201", 4, "12, 12"), "203: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "202, 206", 22, "16, 12"), "204: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "202, 206", 20, "16, 12"), "205: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "202, 206", 17, "16, 12"), "229: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", "228, 230", 6, "12, 12") };
final Configuration checkConfig = getCheckConfig("CommentsIndentation");
final String filePath = getPath("InputCommentsIndentationInSwitchBlock.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 CommentsIndentationTest method testCommentIsInsideEmptyBlock.
@Test
public void testCommentIsInsideEmptyBlock() throws Exception {
final String[] expected = { "9: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 12, 19, 31), "10: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.block", 12, 23, 31), "33: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 34, 0, 8), "57: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 58, 0, 8), "71: " + getCheckMessage(CommentsIndentationCheck.class, "comments.indentation.single", 72, 0, 8) };
final Configuration checkConfig = getCheckConfig("CommentsIndentation");
final String filePath = getPath("InputCommentsIndentationInEmptyBlock.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
Aggregations