Issue #2161: unify test input locations

This commit is contained in:
rnveach 2015-10-10 22:29:54 -04:00 committed by Roman Ivanov
parent 3ad60e5742
commit 59ca05e73c
15 changed files with 45 additions and 32 deletions

View File

@ -25,6 +25,7 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecate
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 +35,11 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class MissingDeprecatedTest extends BaseCheckTestSupport {
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "annotation" + File.separator + filename);
}
@Test
public void testGetRequiredTokens() {
@ -71,7 +77,7 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport {
"56: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_DEPRECATED),
};
verify(checkConfig, getPath("annotation" + File.separator + "InputBadDeprecatedAnnotation.java"), expected);
verify(checkConfig, getPath("InputBadDeprecatedAnnotation.java"), expected);
}
/**
@ -94,7 +100,7 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport {
"55: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_DEPRECATED),
};
verify(checkConfig, getPath("annotation" + File.separator + "BadDeprecatedJavadoc.java"), expected);
verify(checkConfig, getPath("BadDeprecatedJavadoc.java"), expected);
}
/**
@ -121,7 +127,7 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport {
"51: " + getCheckMessage(MSG_KEY_JAVADOC_DUPLICATE_TAG, "@deprecated"),
};
verify(checkConfig, getPath("annotation" + File.separator + "InputSpecialCaseDeprecated.java"), expected);
verify(checkConfig, getPath("InputSpecialCaseDeprecated.java"), expected);
}
/**
@ -134,7 +140,7 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport {
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodDeprecated.java"), expected);
verify(checkConfig, getPath("GoodDeprecated.java"), expected);
}
@Test
@ -148,7 +154,7 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport {
"12: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_DEPRECATED),
};
verify(checkConfig, getPath("annotation" + File.separator + "InputMissingDeprecatedCheckTest1.java"), expected);
verify(checkConfig, getPath("InputMissingDeprecatedCheckTest1.java"), expected);
}
@Test
@ -161,6 +167,6 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport {
"11: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_DEPRECATED),
};
verify(checkConfig, getPath("annotation" + File.separator + "InputMissingDeprecatedCheckTest2.java"), expected);
verify(checkConfig, getPath("InputMissingDeprecatedCheckTest2.java"), expected);
}
}

View File

@ -24,6 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.MissingOverrideC
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
@ -34,6 +35,12 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
public class MissingOverrideCheckTest extends BaseCheckTestSupport {
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "annotation" + File.separator + filename);
}
/**
* This tests that classes not extending anything explicitly will be correctly
* flagged for only including the inheritDoc tag.
@ -50,7 +57,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
"50: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE),
};
verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromObject.java"), expected);
verify(checkConfig, getPath("BadOverrideFromObject.java"), expected);
}
/**
@ -69,7 +76,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
"50: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE),
};
verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromObject.java"), expected);
verify(checkConfig, getPath("BadOverrideFromObject.java"), expected);
}
/**
@ -89,7 +96,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
"63: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE),
};
verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromOther.java"), expected);
verify(checkConfig, getPath("BadOverrideFromOther.java"), expected);
}
/**
@ -103,7 +110,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromOther.java"), expected);
verify(checkConfig, getPath("BadOverrideFromOther.java"), expected);
}
/**
@ -120,7 +127,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
"35: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE),
};
verify(checkConfig, getPath("annotation" + File.separator + "BadAnnotationOverride.java"), expected);
verify(checkConfig, getPath("BadAnnotationOverride.java"), expected);
}
/**
@ -133,7 +140,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("javaFiveCompatibility", "true");
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "BadAnnotationOverride.java"), expected);
verify(checkConfig, getPath("BadAnnotationOverride.java"), expected);
}
/**
@ -147,7 +154,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
"15: " + getCheckMessage(MSG_KEY_TAG_NOT_VALID_ON, "{@inheritDoc}"),
};
verify(checkConfig, getPath("annotation" + File.separator + "NotOverride.java"), expected);
verify(checkConfig, getPath("NotOverride.java"), expected);
}
/**
@ -161,7 +168,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromObject.java"), expected);
verify(checkConfig, getPath("GoodOverrideFromObject.java"), expected);
}
/**
@ -175,7 +182,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromObject.java"), expected);
verify(checkConfig, getPath("GoodOverrideFromObject.java"), expected);
}
/**
@ -187,7 +194,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromOther.java"), expected);
verify(checkConfig, getPath("GoodOverrideFromOther.java"), expected);
}
/**
@ -201,7 +208,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromOther.java"), expected);
verify(checkConfig, getPath("GoodOverrideFromOther.java"), expected);
}
/**
@ -213,7 +220,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodAnnotationOverride.java"), expected);
verify(checkConfig, getPath("GoodAnnotationOverride.java"), expected);
}
/**
@ -226,7 +233,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("javaFiveCompatibility", "true");
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodAnnotationOverride.java"), expected);
verify(checkConfig, getPath("GoodAnnotationOverride.java"), expected);
}
@Test

View File

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

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.annotation;
package com.puppycrawl.tools.checkstyle.checks.annotation;
import java.lang.annotation.Inherited;

View File

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

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.annotation;
package com.puppycrawl.tools.checkstyle.checks.annotation;
import java.io.Serializable;

View File

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

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.annotation;
package com.puppycrawl.tools.checkstyle.checks.annotation;
/**
* @deprecated

View File

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

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.annotation;
package com.puppycrawl.tools.checkstyle.checks.annotation;
import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.annotation;
package com.puppycrawl.tools.checkstyle.checks.annotation;
/**
* @deprecated

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.annotation;
package com.puppycrawl.tools.checkstyle.checks.annotation;
import java.lang.annotation.Inherited;
/**

View File

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

View File

@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.annotation;
package com.puppycrawl.tools.checkstyle.checks.annotation;
/**
* @deprecated bleh

View File

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