Issue #2161: unify test input locations for metrics package
This commit is contained in:
parent
5aacffce41
commit
8ee05486c1
|
|
@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.metrics;
|
|||
import static com.puppycrawl.tools.checkstyle.checks.metrics.ClassFanOutComplexityCheck.MSG_KEY;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Assert;
|
||||
|
|
@ -32,6 +33,12 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
|||
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
||||
|
||||
public class ClassFanOutComplexityCheckTest extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("checks" + File.separator
|
||||
+ "metrics" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
DefaultConfiguration checkConfig = createCheckConfig(ClassFanOutComplexityCheck.class);
|
||||
|
|
@ -43,10 +50,7 @@ public class ClassFanOutComplexityCheckTest extends BaseCheckTestSupport {
|
|||
"38:1: " + getCheckMessage(MSG_KEY, 1, 0),
|
||||
};
|
||||
|
||||
verify(checkConfig,
|
||||
getPath("checks" + File.separator
|
||||
+ "metrics" + File.separator + "ClassCouplingCheckTestInput.java"),
|
||||
expected);
|
||||
verify(checkConfig, getPath("ClassCouplingCheckTestInput.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -67,10 +71,7 @@ public class ClassFanOutComplexityCheckTest extends BaseCheckTestSupport {
|
|||
String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
|
||||
createChecker(checkConfig);
|
||||
verify(checkConfig,
|
||||
getPath("checks" + File.separator
|
||||
+ "metrics" + File.separator + "ClassCouplingCheckTestInput.java"),
|
||||
expected);
|
||||
verify(checkConfig, getPath("ClassCouplingCheckTestInput.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
// someexamples of 1.5 extensions
|
||||
package com.puppycrawl.tools.checkstyle.checks.metrics;
|
||||
|
||||
@interface MyAnnotation1 {
|
||||
String name();
|
||||
int version();
|
||||
}
|
||||
|
||||
@MyAnnotation1(name = "ABC", version = 1)
|
||||
public class Input15Extensions
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
enum Enum1
|
||||
{
|
||||
A, B, C;
|
||||
Enum1() {}
|
||||
public String toString() {
|
||||
return ""; //some custom implementation
|
||||
}
|
||||
}
|
||||
|
||||
interface TestRequireThisEnum
|
||||
{
|
||||
enum DAY_OF_WEEK
|
||||
{
|
||||
SUNDAY,
|
||||
MONDAY,
|
||||
TUESDAY,
|
||||
WEDNESDAY,
|
||||
THURSDAY,
|
||||
FRIDAY,
|
||||
SATURDAY
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue