本文整理汇总了Java中com.puppycrawl.tools.checkstyle.utils.CommonUtils.EMPTY_STRING_ARRAY属性的典型用法代码示例。如果您正苦于以下问题:Java CommonUtils.EMPTY_STRING_ARRAY属性的具体用法?Java CommonUtils.EMPTY_STRING_ARRAY怎么用?Java CommonUtils.EMPTY_STRING_ARRAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.utils.CommonUtils
的用法示例。
在下文中一共展示了CommonUtils.EMPTY_STRING_ARRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testValidArrayInitDefaultIndentWithChecker
@Test
public void testValidArrayInitDefaultIndentWithChecker()
throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class);
checkConfig.addAttribute("arrayInitIndent", "4");
checkConfig.addAttribute("basicOffset", "4");
checkConfig.addAttribute("braceAdjustment", "0");
checkConfig.addAttribute("caseIndent", "4");
checkConfig.addAttribute("forceStrictCondition", "false");
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fileName = getPath("InputIndentationValidArrayInitDefaultIndent.java");
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fileName, expected);
}
示例2: testInvalidInvalidAnonymousClass
@Test
public void testInvalidInvalidAnonymousClass() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class);
checkConfig.addAttribute("arrayInitIndent", "4");
checkConfig.addAttribute("basicOffset", "4");
checkConfig.addAttribute("braceAdjustment", "0");
checkConfig.addAttribute("caseIndent", "4");
checkConfig.addAttribute("forceStrictCondition", "false");
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fileName = getPath("InputIndentationInvalidAnonymousClassIndent.java");
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fileName, expected);
}
示例3: testBundlesWithSameNameButDifferentPaths
@Test
public void testBundlesWithSameNameButDifferentPaths() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(TranslationCheck.class);
checkConfig.addAttribute("requiredTranslations", "de");
checkConfig.addAttribute("fileExtensions", "properties");
checkConfig.addAttribute("baseName", "^.*Labels.*");
final File[] propertyFiles = {
new File(getPath("MyLabelsI18.properties")),
new File(getPath("MyLabelsI18_de.properties")),
new File(getNonCompilablePath("MyLabelsI18.properties")),
new File(getNonCompilablePath("MyLabelsI18_de.properties")),
};
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(
createChecker(checkConfig),
propertyFiles,
getPath(""),
expected);
}
示例4: testInvalidOption
@Test
public void testInvalidOption() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(EmptyBlockCheck.class);
checkConfig.addAttribute("option", "invalid_option");
try {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputEmptyBlockSemantic.java"), expected);
fail("exception expected");
}
catch (CheckstyleException ex) {
final String messageStart =
"cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - "
+ "Cannot set property 'option' to 'invalid_option' in module";
assertTrue("Invalid exception message, should start with: " + messageStart,
ex.getMessage().startsWith(messageStart));
}
}
示例5: testValidDotWithChecker
@Test
public void testValidDotWithChecker()
throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class);
checkConfig.addAttribute("arrayInitIndent", "4");
checkConfig.addAttribute("basicOffset", "4");
checkConfig.addAttribute("braceAdjustment", "0");
checkConfig.addAttribute("caseIndent", "4");
checkConfig.addAttribute("forceStrictCondition", "false");
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fileName = getPath("InputIndentationValidDotIndent.java");
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fileName, expected);
}
示例6: testMaximumDepth
@Test
public void testMaximumDepth()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(DescendantTokenCheck.class);
checkConfig.addAttribute("tokens", "LITERAL_SWITCH");
checkConfig.addAttribute("limitedTokens", "LITERAL_DEFAULT");
checkConfig.addAttribute("maximumNumber", "0");
checkConfig.addAttribute("maximumDepth", "1");
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputDescendantTokenIllegalTokens.java"), expected);
}
示例7: testLabels
@Test
public void testLabels() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class);
checkConfig.addAttribute("arrayInitIndent", "4");
checkConfig.addAttribute("basicOffset", "2");
checkConfig.addAttribute("braceAdjustment", "0");
checkConfig.addAttribute("caseIndent", "4");
checkConfig.addAttribute("forceStrictCondition", "false");
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("InputIndentationLabels.java"), expected);
}
示例8: packageInfoAnnotation
@Test
public void packageInfoAnnotation() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(JavadocStyleCheck.class);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(createChecker(checkConfig),
getPath("pkginfo" + File.separator + "annotation" + File.separator
+ "package-info.java"),
expected);
}
示例9: testDefault
@Test
public void testDefault()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(ParameterNameCheck.class);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputParameterName.java"), expected);
}
示例10: testNullPointerException
@Test
public void testNullPointerException() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
checkConfig.addAttribute("allowedAbbreviationLength", "2");
checkConfig.addAttribute("ignoreFinal", "false");
checkConfig.addAttribute("allowedAbbreviations", null);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
getPath("InputAbbreviationAsWordInNameAbstractMultisetSetCount.java"),
expected);
}
示例11: testCanParse
@Test
public void testCanParse()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(MemberNameCheck.class);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputJava7StringSwitch.java"), expected);
}
示例12: testCanParse
@Test
public void testCanParse()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(MemberNameCheck.class);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputVararg.java"), expected);
}
示例13: testCanParse
@Test
public void testCanParse()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(MemberNameCheck.class);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputDefaultMethods.java"), expected);
}
示例14: testIgnore
@Test
public void testIgnore() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(HeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("InputHeaderjava.header"));
checkConfig.addAttribute("ignoreLines", "2");
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputHeaderjava2.header"), expected);
}
示例15: testMinimumDepth
@Test
public void testMinimumDepth()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(DescendantTokenCheck.class);
checkConfig.addAttribute("tokens", "LITERAL_SWITCH");
checkConfig.addAttribute("limitedTokens", "LITERAL_DEFAULT");
checkConfig.addAttribute("maximumNumber", "0");
checkConfig.addAttribute("minimumDepth", "3");
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputDescendantTokenIllegalTokens.java"), expected);
}