Issue #2161: unify test input locations for sizes package

This commit is contained in:
rnveach 2015-10-15 20:15:07 -04:00 committed by Roman Ivanov
parent 7e5e919ce7
commit f0f26b9e91
8 changed files with 35 additions and 9 deletions

View File

@ -22,6 +22,9 @@ package com.puppycrawl.tools.checkstyle.checks.sizes;
import static com.puppycrawl.tools.checkstyle.checks.sizes.AnonInnerLengthCheck.MSG_KEY;
import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import java.io.IOException;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -34,6 +37,11 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
* @author Lars Kühne
*/
public class AnonInnerLengthCheckTest extends BaseCheckTestSupport {
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "sizes" + File.separator + filename);
}
@Test
public void testGetRequiredTokens() {

View File

@ -21,10 +21,14 @@ package com.puppycrawl.tools.checkstyle.checks.sizes;
import static com.puppycrawl.tools.checkstyle.checks.sizes.ExecutableStatementCountCheck.MSG_KEY;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import antlr.CommonHiddenStreamToken;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
@ -32,6 +36,12 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class ExecutableStatementCountCheckTest
extends BaseCheckTestSupport {
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "sizes" + File.separator + filename);
}
@Test
public void testMaxZero() throws Exception {
final DefaultConfiguration checkConfig =

View File

@ -26,6 +26,9 @@ import static com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.MSG_
import static com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.MSG_PUBLIC_METHODS;
import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
@ -34,6 +37,11 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class MethodCountCheckTest extends BaseCheckTestSupport {
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "sizes" + File.separator + filename);
}
@Test
public void testGetRequiredTokens() {
@ -65,7 +73,7 @@ public class MethodCountCheckTest extends BaseCheckTestSupport {
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("sizes/MethodCountCheckInput.java"), expected);
verify(checkConfig, getPath("MethodCountCheckInput.java"), expected);
}
@Test
@ -90,7 +98,7 @@ public class MethodCountCheckTest extends BaseCheckTestSupport {
"45: " + getCheckMessage(MSG_MANY_METHODS, 5, 3),
};
verify(checkConfig, getPath("sizes/MethodCountCheckInput.java"), expected);
verify(checkConfig, getPath("MethodCountCheckInput.java"), expected);
}
@Test
@ -105,7 +113,7 @@ public class MethodCountCheckTest extends BaseCheckTestSupport {
"9: " + getCheckMessage(MSG_MANY_METHODS, 3, 2),
};
verify(checkConfig, getPath("sizes/MethodCountCheckInput2.java"), expected);
verify(checkConfig, getPath("MethodCountCheckInput2.java"), expected);
}
@Test
@ -118,6 +126,6 @@ public class MethodCountCheckTest extends BaseCheckTestSupport {
"3: " + getCheckMessage(MSG_MANY_METHODS, 5, 2),
};
verify(checkConfig, getPath("sizes/MethodCountCheckInput3.java"), expected);
verify(checkConfig, getPath("MethodCountCheckInput3.java"), expected);
}
}

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle;
package com.puppycrawl.tools.checkstyle.checks.sizes;
public class ExecutableStatementCountInput {
public void foo() {

View File

@ -2,7 +2,7 @@
// Test case file for checkstyle.
// Created: 2002
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle;
package com.puppycrawl.tools.checkstyle.checks.sizes;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.sizes;
package com.puppycrawl.tools.checkstyle.checks.sizes;
public class MethodCountCheckInput {

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.sizes;
package com.puppycrawl.tools.checkstyle.checks.sizes;
public enum MethodCountCheckInput2 {

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.sizes;
package com.puppycrawl.tools.checkstyle.checks.sizes;
public class MethodCountCheckInput3 {