Issue #2161: unify test input locations
This commit is contained in:
parent
c3af3e410f
commit
d7cf4f652e
|
|
@ -88,8 +88,7 @@ public class BaseCheckTestSupport {
|
|||
return dc;
|
||||
}
|
||||
|
||||
protected String getPath(String filename)
|
||||
throws IOException {
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return new File("src/test/resources/com/puppycrawl/tools/checkstyle/" + filename).getCanonicalPath();
|
||||
}
|
||||
|
||||
|
|
@ -98,10 +97,14 @@ public class BaseCheckTestSupport {
|
|||
}
|
||||
|
||||
protected String getSrcPath(String filename) throws IOException {
|
||||
|
||||
return new File("src/test/java/com/puppycrawl/tools/checkstyle/" + filename).getCanonicalPath();
|
||||
}
|
||||
|
||||
protected String getNonCompilablePath(String filename) throws IOException {
|
||||
return new File("src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/"
|
||||
+ filename).getCanonicalPath();
|
||||
}
|
||||
|
||||
protected void verify(Configuration aConfig, String fileName, String... expected)
|
||||
throws Exception {
|
||||
verify(createChecker(aConfig), fileName, fileName, expected);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding;
|
|||
import static com.puppycrawl.tools.checkstyle.checks.coding.DefaultComesLastCheck.MSG_KEY;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Assert;
|
||||
|
|
@ -31,6 +32,18 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
|
|||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class DefaultComesLastCheckTest extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("checks" + File.separator
|
||||
+ "coding" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getNonCompilablePath(String filename) throws IOException {
|
||||
return super.getNonCompilablePath("checks" + File.separator
|
||||
+ "coding" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIt() throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
|
|
@ -40,7 +53,7 @@ public class DefaultComesLastCheckTest extends BaseCheckTestSupport {
|
|||
"31:24: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig,
|
||||
getPath("coding" + File.separator + "InputDefaultComesLast.java"),
|
||||
getPath("InputDefaultComesLast.java"),
|
||||
expected);
|
||||
}
|
||||
|
||||
|
|
@ -51,10 +64,8 @@ public class DefaultComesLastCheckTest extends BaseCheckTestSupport {
|
|||
createCheckConfig(DefaultComesLastCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig,
|
||||
new File(
|
||||
"src/test/resources-noncompilable/com/puppycrawl/tools/"
|
||||
+ "checkstyle/coding/InputDefaultComesLast2.java").getCanonicalPath(),
|
||||
expected);
|
||||
getNonCompilablePath("InputDefaultComesLast2.java"),
|
||||
expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
//Compilable with Java8
|
||||
package com.puppycrawl.tools.checkstyle.coding;
|
||||
package com.puppycrawl.tools.checkstyle.checks.coding;
|
||||
public interface JsonTranslator {
|
||||
|
||||
String toJson(Response one, Response two, Response three);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.coding;
|
||||
package com.puppycrawl.tools.checkstyle.checks.coding;
|
||||
|
||||
public class InputDefaultComesLast
|
||||
{
|
||||
Loading…
Reference in New Issue