Issue #2161: unify test input locations
This commit is contained in:
parent
3ad60e5742
commit
59ca05e73c
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
public class BadAnnotationOverride
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
public class BadOverrideFromObject
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
public class GoodAnnotationOverride
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
public class GoodOverrideFromObject
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
/**
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
public class InputMissingDeprecatedCheckTest2 {
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
/**
|
||||
* @deprecated bleh
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.annotation;
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
public class NotOverride
|
||||
{
|
||||
Loading…
Reference in New Issue