Move across to the correct package
This commit is contained in:
parent
de9f3e7b88
commit
913cb76d04
|
|
@ -1,14 +1,42 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.*;
|
||||
import com.puppycrawl.tools.checkstyle.checks.AvoidStarImportTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.ConstantNameCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.EmptyBlockCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.EqualsHashCodeCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.IllegalImportCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.JavadocMethodCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.JavadocTypeCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.JavadocVariableCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.LineLengthCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.LocalFinalVariableNameCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.LocalVariableNameCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.MemberNameCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.MethodLeftCurlyCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.MethodLengthCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.MethodNameCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.ModifierCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.NeedBracesCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.NoWhitespaceAfterCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.NoWhitespaceBeforeCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.RedundantImportCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.RedundantModifierTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.RightCurlyCheckTest;
|
||||
import com
|
||||
.puppycrawl
|
||||
.tools
|
||||
.checkstyle
|
||||
.checks
|
||||
.SimplifyBooleanExpressionCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.SimplifyBooleanReturnCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.StaticVariableNameCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.TabCharacterCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.TodoCommentCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.TypeLeftCurlyCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.TypeNameCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.UnusedImportsCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.UpperEllCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.VisibilityModifierCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.WhitespaceAfterCheckTest;
|
||||
import com.puppycrawl.tools.checkstyle.checks.WhitespaceAroundTest;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.api.Scope;
|
||||
import com.puppycrawl.tools.checkstyle.checks.JavadocMethodCheck;
|
||||
|
||||
|
||||
public class JavadocMethodCheckTest
|
||||
|
|
@ -12,8 +13,6 @@ public class JavadocMethodCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputTags.java");
|
||||
final String[] expected = {
|
||||
"14:5: Missing a Javadoc comment.",
|
||||
"18: Unused @param tag for 'unused'.",
|
||||
|
|
@ -39,7 +38,7 @@ public class JavadocMethodCheckTest
|
|||
"179: Unused @throws tag for 'ArrayStoreException'.",
|
||||
};
|
||||
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputTags.java"), expected);
|
||||
}
|
||||
|
||||
public void testTagsWithResolver()
|
||||
|
|
@ -48,8 +47,6 @@ public class JavadocMethodCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
checkConfig.addAttribute("checkUnusedThrows", "true");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputTags.java");
|
||||
final String[] expected = {
|
||||
"14:5: Missing a Javadoc comment.",
|
||||
"18: Unused @param tag for 'unused'.",
|
||||
|
|
@ -73,7 +70,7 @@ public class JavadocMethodCheckTest
|
|||
"109:55: Expected @param tag for 'aFour'.",
|
||||
"109:66: Expected @param tag for 'aFive'.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputTags.java"), expected);
|
||||
}
|
||||
|
||||
public void testStrictJavadoc()
|
||||
|
|
@ -81,8 +78,6 @@ public class JavadocMethodCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputPublicOnly.java");
|
||||
final String[] expected = {
|
||||
"12:9: Missing a Javadoc comment.",
|
||||
"18:13: Missing a Javadoc comment.",
|
||||
|
|
@ -98,7 +93,7 @@ public class JavadocMethodCheckTest
|
|||
"84:5: Missing a Javadoc comment.",
|
||||
"94:32: Expected @param tag for 'aA'."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
|
||||
}
|
||||
|
||||
public void testNoJavadoc()
|
||||
|
|
@ -107,11 +102,9 @@ public class JavadocMethodCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.NOTHING.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputPublicOnly.java");
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
|
||||
}
|
||||
|
||||
// pre 1.4 relaxed mode is roughly equivalent with check=protected
|
||||
|
|
@ -122,15 +115,13 @@ public class JavadocMethodCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PROTECTED.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputPublicOnly.java");
|
||||
final String[] expected = {
|
||||
"59:5: Missing a Javadoc comment.",
|
||||
"64:5: Missing a Javadoc comment.",
|
||||
"79:5: Missing a Javadoc comment.",
|
||||
"84:5: Missing a Javadoc comment."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -140,13 +131,11 @@ public class JavadocMethodCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PUBLIC.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputScopeInnerInterfaces.java");
|
||||
final String[] expected = {
|
||||
"43:9: Missing a Javadoc comment.",
|
||||
"44:9: Missing a Javadoc comment."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected);
|
||||
}
|
||||
|
||||
public void testScopeAnonInnerPrivate()
|
||||
|
|
@ -155,11 +144,9 @@ public class JavadocMethodCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PRIVATE.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputScopeAnonInner.java");
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputScopeAnonInner.java"), expected);
|
||||
}
|
||||
|
||||
public void testScopeAnonInnerAnonInner()
|
||||
|
|
@ -168,14 +155,12 @@ public class JavadocMethodCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.ANONINNER.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputScopeAnonInner.java");
|
||||
final String[] expected = {
|
||||
"26:9: Missing a Javadoc comment.",
|
||||
"39:17: Missing a Javadoc comment.",
|
||||
"53:17: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputScopeAnonInner.java"), expected);
|
||||
}
|
||||
|
||||
public void testScopeAnonInnerWithResolver()
|
||||
|
|
@ -184,10 +169,8 @@ public class JavadocMethodCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
checkConfig.addAttribute("checkUnusedThrows", "true");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputScopeAnonInner.java");
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputScopeAnonInner.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.api.Scope;
|
||||
import com.puppycrawl.tools.checkstyle.checks.JavadocTypeCheck;
|
||||
|
||||
/**
|
||||
* @author Oliver.Burn
|
||||
|
|
@ -17,36 +18,30 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputTags.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"8: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputTags.java"), expected);
|
||||
}
|
||||
|
||||
public void testInner() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputInner.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"14: Missing a Javadoc comment.",
|
||||
"21: Missing a Javadoc comment.",
|
||||
"27: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputInner.java"), expected);
|
||||
}
|
||||
|
||||
public void testStrict() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputPublicOnly.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"7: Missing a Javadoc comment.",
|
||||
|
|
@ -54,7 +49,7 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
"14: Missing a Javadoc comment.",
|
||||
"34: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
|
||||
}
|
||||
|
||||
public void testProtected() throws Exception
|
||||
|
|
@ -62,13 +57,11 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PROTECTED.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputPublicOnly.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"7: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
|
||||
}
|
||||
|
||||
public void testPublic() throws Exception
|
||||
|
|
@ -76,14 +69,12 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PUBLIC.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputScopeInnerInterfaces.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"7: Missing a Javadoc comment.",
|
||||
"38: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected);
|
||||
}
|
||||
|
||||
public void testProtest() throws Exception
|
||||
|
|
@ -91,15 +82,13 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PROTECTED.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputScopeInnerInterfaces.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"7: Missing a Javadoc comment.",
|
||||
"29: Missing a Javadoc comment.",
|
||||
"38: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected);
|
||||
}
|
||||
|
||||
public void testPkg() throws Exception
|
||||
|
|
@ -109,15 +98,13 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
checkConfig.addAttribute(
|
||||
"scope",
|
||||
Scope.getInstance("package").getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputScopeInnerClasses.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"18: Missing a Javadoc comment.",
|
||||
"20: Missing a Javadoc comment.",
|
||||
"22: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputScopeInnerClasses.java"), expected);
|
||||
}
|
||||
|
||||
public void testEclipse() throws Exception
|
||||
|
|
@ -127,13 +114,11 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
checkConfig.addAttribute(
|
||||
"scope",
|
||||
Scope.getInstance("public").getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputScopeInnerClasses.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"18: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputScopeInnerClasses.java"), expected);
|
||||
}
|
||||
|
||||
public void testAuthorRequired() throws Exception
|
||||
|
|
@ -141,13 +126,11 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("authorFormat", "\\S");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputWhitespace.java");
|
||||
final String[] expected =
|
||||
{
|
||||
"13: Type Javadoc comment is missing an @author tag.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputWhitespace.java"), expected);
|
||||
}
|
||||
|
||||
public void testAuthorRegularEx()
|
||||
|
|
@ -156,12 +139,9 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("authorFormat", "0*");
|
||||
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputJavadoc.java");
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputJavadoc.java"), expected);
|
||||
}
|
||||
|
||||
public void testAuthorRegularExError()
|
||||
|
|
@ -170,13 +150,10 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("authorFormat", "ABC");
|
||||
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputJavadoc.java");
|
||||
final String[] expected = {
|
||||
"13: Type Javadoc comment is missing an @author tag.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputJavadoc.java"), expected);
|
||||
}
|
||||
|
||||
public void testVersionRequired()
|
||||
|
|
@ -185,13 +162,10 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("versionFormat", "\\S");
|
||||
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputWhitespace.java");
|
||||
final String[] expected = {
|
||||
"13: Type Javadoc comment is missing an @version tag."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputWhitespace.java"), expected);
|
||||
}
|
||||
|
||||
public void testVersionRegularEx()
|
||||
|
|
@ -200,12 +174,9 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("versionFormat", "[:digit:].*");
|
||||
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputJavadoc.java");
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputJavadoc.java"), expected);
|
||||
}
|
||||
|
||||
public void testVersionRegularExError()
|
||||
|
|
@ -214,12 +185,9 @@ public class JavadocTypeCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocTypeCheck.class);
|
||||
checkConfig.addAttribute("versionFormat", "\\$Revision.*\\$");
|
||||
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputJavadoc.java");
|
||||
final String[] expected = {
|
||||
"13: Type Javadoc comment is missing an @version tag."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputJavadoc.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.api.Scope;
|
||||
import com.puppycrawl.tools.checkstyle.checks.JavadocVariableCheck;
|
||||
|
||||
|
||||
public class JavadocVariableCheckTest
|
||||
|
|
@ -12,12 +13,10 @@ public class JavadocVariableCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocVariableCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputTags.java");
|
||||
final String[] expected = {
|
||||
"11:5: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputTags.java"), expected);
|
||||
}
|
||||
|
||||
public void testAnother()
|
||||
|
|
@ -25,14 +24,12 @@ public class JavadocVariableCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocVariableCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputInner.java");
|
||||
final String[] expected = {
|
||||
"17:9: Missing a Javadoc comment.",
|
||||
"24:9: Missing a Javadoc comment.",
|
||||
"30:13: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputInner.java"), expected);
|
||||
}
|
||||
|
||||
public void testAnother2()
|
||||
|
|
@ -41,11 +38,9 @@ public class JavadocVariableCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocVariableCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PUBLIC.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputInner.java");
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputInner.java"), expected);
|
||||
}
|
||||
|
||||
public void testAnother3()
|
||||
|
|
@ -53,8 +48,6 @@ public class JavadocVariableCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocVariableCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputPublicOnly.java");
|
||||
final String[] expected = {
|
||||
"11:9: Missing a Javadoc comment.",
|
||||
"16:13: Missing a Javadoc comment.",
|
||||
|
|
@ -64,7 +57,7 @@ public class JavadocVariableCheckTest
|
|||
"45:5: Missing a Javadoc comment.",
|
||||
"46:5: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
|
||||
}
|
||||
public void testAnother4()
|
||||
throws Exception
|
||||
|
|
@ -72,11 +65,9 @@ public class JavadocVariableCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocVariableCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PUBLIC.getName());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputPublicOnly.java");
|
||||
final String[] expected = {
|
||||
"46:5: Missing a Javadoc comment.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.LineLengthCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class LineLengthCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
|
|
@ -11,12 +12,10 @@ public class LineLengthCheckTest extends BaseCheckTestCase
|
|||
createCheckConfig(LineLengthCheck.class);
|
||||
checkConfig.addAttribute("max", "80");
|
||||
checkConfig.addAttribute("ignorePattern", "^.*is OK.*regexp.*$");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String filepath = getPath("InputSimple.java");
|
||||
final String[] expected = {
|
||||
"18: Line is longer than 80 characters.",
|
||||
"145: Line is longer than 80 characters.",
|
||||
};
|
||||
verify(c, filepath, expected);
|
||||
verify(checkConfig, getPath("InputSimple.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.LocalFinalVariableNameCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class LocalFinalVariableNameCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -10,12 +11,10 @@ public class LocalFinalVariableNameCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(LocalFinalVariableNameCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputSimple.java");
|
||||
final String[] expected = {
|
||||
"123:19: Name 'CDE' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputSimple.java"), expected);
|
||||
}
|
||||
|
||||
public void testSet()
|
||||
|
|
@ -24,12 +23,10 @@ public class LocalFinalVariableNameCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(LocalFinalVariableNameCheck.class);
|
||||
checkConfig.addAttribute("format", "[A-Z]+");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputSimple.java");
|
||||
final String[] expected = {
|
||||
"122:19: Name 'cde' must match pattern '[A-Z]+'.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputSimple.java"), expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.LocalVariableNameCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class LocalVariableNameCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -10,14 +11,12 @@ public class LocalVariableNameCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(LocalVariableNameCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputSimple.java");
|
||||
final String[] expected = {
|
||||
"119:13: Name 'ABC' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
|
||||
"130:18: Name 'I' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
|
||||
"132:20: Name 'InnerBlockVariable' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputSimple.java"), expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.MemberNameCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class MemberNameCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -11,12 +12,10 @@ public class MemberNameCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
checkConfig.addAttribute("format", "^m[A-Z][a-zA-Z0-9]*$");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputSimple.java");
|
||||
final String[] expected = {
|
||||
"35:17: Name 'badMember' must match pattern '^m[A-Z][a-zA-Z0-9]*$'.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputSimple.java"), expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.MethodLeftCurlyCheck;
|
||||
import com.puppycrawl.tools.checkstyle.checks.LeftCurlyOption;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class MethodLeftCurlyCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -11,14 +11,12 @@ public class MethodLeftCurlyCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MethodLeftCurlyCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputLeftCurlyMethod.java");
|
||||
final String[] expected = {
|
||||
"17:5: '{' should be on the previous line.",
|
||||
"24:5: '{' should be on the previous line.",
|
||||
"31:5: '{' should be on the previous line.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputLeftCurlyMethod.java"), expected);
|
||||
}
|
||||
|
||||
public void testNL()
|
||||
|
|
@ -27,13 +25,11 @@ public class MethodLeftCurlyCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MethodLeftCurlyCheck.class);
|
||||
checkConfig.addAttribute("option", LeftCurlyOption.NL.toString());
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputLeftCurlyMethod.java");
|
||||
final String[] expected = {
|
||||
"14:39: '{' should be on a new line.",
|
||||
"21:20: '{' should be on a new line.",
|
||||
"34:31: '{' should be on a new line.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputLeftCurlyMethod.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,9 +16,10 @@
|
|||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.MethodLengthCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class MethodLengthCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
|
|
@ -27,22 +28,18 @@ public class MethodLengthCheckTest extends BaseCheckTestCase
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MethodLengthCheck.class);
|
||||
checkConfig.addAttribute("max", "19");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputSimple.java");
|
||||
final String[] expected = {
|
||||
"79:5: Method length is 20 lines (max allowed is 19)."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputSimple.java"), expected);
|
||||
}
|
||||
|
||||
public void testAbstract() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MethodLengthCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputModifier.java");
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputModifier.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.MethodNameCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class MethodNameCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -10,11 +11,9 @@ public class MethodNameCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MethodNameCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputSimple.java");
|
||||
final String[] expected = {
|
||||
"137:10: Name 'ALL_UPPERCASE_METHOD' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputSimple.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.ModifierCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class ModifierCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -9,14 +10,11 @@ public class ModifierCheckTest
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ModifierCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String filepath = getPath("InputModifier.java");
|
||||
assertNotNull(c);
|
||||
final String[] expected = {
|
||||
"14:10: 'final' modifier out of order with the JLS suggestions.",
|
||||
"18:12: 'private' modifier out of order with the JLS suggestions.",
|
||||
"24:14: 'private' modifier out of order with the JLS suggestions.",
|
||||
};
|
||||
verify(c, filepath, expected);
|
||||
verify(checkConfig, getPath("InputModifier.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,9 +16,10 @@
|
|||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.NeedBracesCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class NeedBracesCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
|
|
@ -26,8 +27,6 @@ public class NeedBracesCheckTest extends BaseCheckTestCase
|
|||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(NeedBracesCheck.class);
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputBraces.java");
|
||||
final String[] expected = {
|
||||
"29: 'do' construct must use '{}'s." ,
|
||||
"41: 'while' construct must use '{}'s." ,
|
||||
|
|
@ -47,6 +46,6 @@ public class NeedBracesCheckTest extends BaseCheckTestCase
|
|||
"99: 'if' construct must use '{}'s." ,
|
||||
"100: 'if' construct must use '{}'s." ,
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputBraces.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.NoWhitespaceAfterCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class NoWhitespaceAfterCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -15,8 +16,6 @@ public class NoWhitespaceAfterCheckTest
|
|||
public void testDefault() throws Exception
|
||||
{
|
||||
checkConfig.addAttribute("allowLineBreaks", "false");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputWhitespace.java");
|
||||
final String[] expected = {
|
||||
"5:14: '.' is followed by whitespace.",
|
||||
"6:12: '.' is followed by whitespace.",
|
||||
|
|
@ -30,20 +29,18 @@ public class NoWhitespaceAfterCheckTest
|
|||
"132:11: '.' is followed by whitespace.",
|
||||
"136:12: '.' is followed by whitespace."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputWhitespace.java"), expected);
|
||||
}
|
||||
|
||||
public void testDotAllowLineBreaks() throws Exception
|
||||
{
|
||||
checkConfig.addAttribute("tokens", "DOT");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputWhitespace.java");
|
||||
final String[] expected = {
|
||||
"5:14: '.' is followed by whitespace.",
|
||||
"129:24: '.' is followed by whitespace.",
|
||||
"136:12: '.' is followed by whitespace."
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputWhitespace.java"), expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.checks.NoWhitespaceBeforeCheck;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
public class NoWhitespaceBeforeCheckTest
|
||||
extends BaseCheckTestCase
|
||||
|
|
@ -13,20 +14,16 @@ public class NoWhitespaceBeforeCheckTest
|
|||
|
||||
public void testDefault() throws Exception
|
||||
{
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputWhitespace.java");
|
||||
final String[] expected = {
|
||||
"30:14: '++' is preceeded with whitespace.",
|
||||
"30:21: '--' is preceeded with whitespace.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputWhitespace.java"), expected);
|
||||
}
|
||||
|
||||
public void testDot() throws Exception
|
||||
{
|
||||
checkConfig.addAttribute("tokens", "DOT");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputWhitespace.java");
|
||||
final String[] expected = {
|
||||
"5:12: '.' is preceeded with whitespace.",
|
||||
"6:4: '.' is preceeded with whitespace.",
|
||||
|
|
@ -34,7 +31,7 @@ public class NoWhitespaceBeforeCheckTest
|
|||
"135:12: '.' is preceeded with whitespace.",
|
||||
"136:10: '.' is preceeded with whitespace.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputWhitespace.java"), expected);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -42,14 +39,12 @@ public class NoWhitespaceBeforeCheckTest
|
|||
{
|
||||
checkConfig.addAttribute("tokens", "DOT");
|
||||
checkConfig.addAttribute("allowLineBreaks", "yes");
|
||||
final Checker c = createChecker(checkConfig);
|
||||
final String fname = getPath("InputWhitespace.java");
|
||||
final String[] expected = {
|
||||
"5:12: '.' is preceeded with whitespace.",
|
||||
"129:17: '.' is preceeded with whitespace.",
|
||||
"136:10: '.' is preceeded with whitespace.",
|
||||
};
|
||||
verify(c, fname, expected);
|
||||
verify(checkConfig, getPath("InputWhitespace.java"), expected);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue