Search in sources :

Example 1 with VariableDeclarationUsageDistanceCheck

use of com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck in project checkstyle by checkstyle.

the class VariableDeclarationUsageDistanceTest method arrayTypeStyleTest.

@Test
public void arrayTypeStyleTest() throws Exception {
    final String msgExt = "variable.declaration.usage.distance.extend";
    final Class<VariableDeclarationUsageDistanceCheck> clazz = VariableDeclarationUsageDistanceCheck.class;
    final String[] expected = { "71: " + getCheckMessage(clazz, msgExt, "count", 4, 3), "219: " + getCheckMessage(clazz, msgExt, "t", 5, 3), "479: " + getCheckMessage(clazz, msgExt, "myOption", 7, 3), "491: " + getCheckMessage(clazz, msgExt, "myOption", 6, 3) };
    final Configuration checkConfig = getCheckConfig("VariableDeclarationUsageDistance");
    final String filePath = getPath("InputVariableDeclarationUsageDistanceCheck.java");
    final Integer[] warnList = getLinesWithWarn(filePath);
    verify(checkConfig, filePath, expected, warnList);
}
Also used : VariableDeclarationUsageDistanceCheck(com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck) Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) Test(org.junit.Test)

Aggregations

Configuration (com.puppycrawl.tools.checkstyle.api.Configuration)1 VariableDeclarationUsageDistanceCheck (com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck)1 Test (org.junit.Test)1