Issue #2836: moved inline strings to error message fields
This commit is contained in:
parent
77733a4523
commit
cd8f1c3183
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package com.google.checkstyle.test.chapter2filebasic.rule21filename;
|
||||
|
||||
import static com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck.MSG_KEY;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
@ -65,7 +67,7 @@ public class OuterTypeFilenameTest extends BaseCheckTestSupport {
|
|||
public void outerTypeFilenameTest3() throws Exception {
|
||||
|
||||
final String[] expected = {
|
||||
"3: " + getCheckMessage(OuterTypeFilenameCheck.class, "type.file.mismatch"),
|
||||
"3: " + getCheckMessage(OuterTypeFilenameCheck.class, MSG_KEY),
|
||||
};
|
||||
|
||||
final Configuration checkConfig = getCheckConfig("OuterTypeFilename");
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package com.google.checkstyle.test.chapter2filebasic.rule233nonascii;
|
||||
|
||||
import static com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck.MSG_KEY;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
@ -39,16 +41,13 @@ public class AvoidEscapedUnicodeCharactersTest extends BaseCheckTestSupport {
|
|||
@Test
|
||||
public void unicodeEscapesTest() throws Exception {
|
||||
|
||||
final String msg = getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class,
|
||||
"forbid.escaped.unicode.char");
|
||||
|
||||
final String[] expected = {
|
||||
"5: " + msg,
|
||||
"15: " + msg,
|
||||
"25: " + msg,
|
||||
"33: " + msg,
|
||||
"35: " + msg,
|
||||
"36: " + msg,
|
||||
"5: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY),
|
||||
"15: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY),
|
||||
"25: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY),
|
||||
"33: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY),
|
||||
"35: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY),
|
||||
"36: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY),
|
||||
};
|
||||
|
||||
final Configuration checkConfig = getCheckConfig("AvoidEscapedUnicodeCharacters");
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package com.google.checkstyle.test.chapter4formatting.rule4832nocstylearray;
|
||||
|
||||
import static com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck.MSG_KEY;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
@ -39,15 +41,13 @@ public class ArrayTypeStyleTest extends BaseCheckTestSupport {
|
|||
@Test
|
||||
public void arrayTypeStyleTest() throws Exception {
|
||||
|
||||
final String msg = getCheckMessage(ArrayTypeStyleCheck.class, "array.type.style");
|
||||
|
||||
final String[] expected = {
|
||||
"9:23: " + msg,
|
||||
"15:44: " + msg,
|
||||
"21:20: " + msg,
|
||||
"22:23: " + msg,
|
||||
"41:16: " + msg,
|
||||
"42:19: " + msg,
|
||||
"9:23: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY),
|
||||
"15:44: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY),
|
||||
"21:20: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY),
|
||||
"22:23: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY),
|
||||
"41:16: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY),
|
||||
"42:19: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY),
|
||||
};
|
||||
|
||||
final Configuration checkConfig = getCheckConfig("ArrayTypeStyle");
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
|||
* @author lkuehne
|
||||
*/
|
||||
public class ArrayTypeStyleCheck extends Check {
|
||||
/**
|
||||
* A key is pointing to the warning message text in "messages.properties"
|
||||
* file.
|
||||
*/
|
||||
public static final String MSG_KEY = "array.type.style";
|
||||
|
||||
/** Controls whether to use Java or C style. */
|
||||
private boolean javaStyle = true;
|
||||
|
||||
|
|
@ -70,7 +76,7 @@ public class ArrayTypeStyleCheck extends Check {
|
|||
|| variableAST.getColumnNo() > ast.getColumnNo();
|
||||
|
||||
if (isJavaStyle != javaStyle) {
|
||||
log(ast.getLineNo(), ast.getColumnNo(), "array.type.style");
|
||||
log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,12 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
|||
*/
|
||||
public class AvoidEscapedUnicodeCharactersCheck
|
||||
extends Check {
|
||||
/**
|
||||
* A key is pointing to the warning message text in "messages.properties"
|
||||
* file.
|
||||
*/
|
||||
public static final String MSG_KEY = "forbid.escaped.unicode.char";
|
||||
|
||||
/** Regular expression for Unicode chars. */
|
||||
private static final Pattern UNICODE_REGEXP = Pattern.compile("\\\\u[a-fA-F0-9]{4}");
|
||||
|
||||
|
|
@ -216,7 +222,7 @@ public class AvoidEscapedUnicodeCharactersCheck
|
|||
&& isOnlyUnicodeValidChars(literal, UNICODE_CONTROL)
|
||||
|| allowNonPrintableEscapes
|
||||
&& isOnlyUnicodeValidChars(literal, NON_PRINTABLE_CHARS))) {
|
||||
log(ast.getLineNo(), "forbid.escaped.unicode.char");
|
||||
log(ast.getLineNo(), MSG_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
|||
* @author maxvetrenko
|
||||
*/
|
||||
public class OuterTypeFilenameCheck extends Check {
|
||||
/**
|
||||
* A key is pointing to the warning message text in "messages.properties"
|
||||
* file.
|
||||
*/
|
||||
public static final String MSG_KEY = "type.file.mismatch";
|
||||
|
||||
/** Pattern matching any file extension with dot included. */
|
||||
private static final Pattern FILE_EXTENSION_PATTERN = Pattern.compile("\\.[^\\.]*$");
|
||||
|
||||
|
|
@ -102,7 +108,7 @@ public class OuterTypeFilenameCheck extends Check {
|
|||
@Override
|
||||
public void finishTree(DetailAST rootAST) {
|
||||
if (!validFirst && !hasPublic && wrongType != null) {
|
||||
log(wrongType.getLineNo(), "type.file.mismatch");
|
||||
log(wrongType.getLineNo(), MSG_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ import com.puppycrawl.tools.checkstyle.utils.AnnotationUtility;
|
|||
*/
|
||||
public class PackageAnnotationCheck extends Check {
|
||||
|
||||
/**
|
||||
* A key is pointing to the warning message text in "messages.properties"
|
||||
* file.
|
||||
*/
|
||||
public static final String MSG_KEY = "annotation.package.location";
|
||||
|
||||
@Override
|
||||
public int[] getDefaultTokens() {
|
||||
return getRequiredTokens();
|
||||
|
|
@ -71,7 +77,7 @@ public class PackageAnnotationCheck extends Check {
|
|||
getFileContents().inPackageInfo();
|
||||
|
||||
if (containsAnnotation && !inPackageInfo) {
|
||||
log(ast.getLine(), "annotation.package.location");
|
||||
log(ast.getLine(), MSG_KEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,18 @@ import java.util.regex.Matcher;
|
|||
* @author oliver
|
||||
*/
|
||||
class SinglelineDetector {
|
||||
/**
|
||||
* A key is pointing to the warning message text in "messages.properties"
|
||||
* file.
|
||||
*/
|
||||
public static final String MSG_REGEXP_EXCEEDED = "regexp.exceeded";
|
||||
|
||||
/**
|
||||
* A key is pointing to the warning message text in "messages.properties"
|
||||
* file.
|
||||
*/
|
||||
public static final String MSG_REGEXP_MINIMUM = "regexp.minimum";
|
||||
|
||||
/** The detection options to use. */
|
||||
private final DetectorOptions options;
|
||||
/** Tracks the number of matches. */
|
||||
|
|
@ -58,7 +70,7 @@ class SinglelineDetector {
|
|||
private void finish() {
|
||||
if (currentMatches < options.getMinimum()) {
|
||||
if (options.getMessage().isEmpty()) {
|
||||
options.getReporter().log(0, "regexp.minimum",
|
||||
options.getReporter().log(0, MSG_REGEXP_MINIMUM,
|
||||
options.getMinimum(), options.getFormat());
|
||||
}
|
||||
else {
|
||||
|
|
@ -107,7 +119,7 @@ class SinglelineDetector {
|
|||
currentMatches++;
|
||||
if (currentMatches > options.getMaximum()) {
|
||||
if (options.getMessage().isEmpty()) {
|
||||
options.getReporter().log(lineNo, "regexp.exceeded",
|
||||
options.getReporter().log(lineNo, MSG_REGEXP_EXCEEDED,
|
||||
matcher.pattern().toString());
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import static com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck.MSG_KEY;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
|
@ -51,8 +52,8 @@ public class ArrayTypeStyleCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ArrayTypeStyleCheck.class);
|
||||
final String[] expected = {
|
||||
"14:23: Array brackets at illegal position.",
|
||||
"20:44: Array brackets at illegal position.",
|
||||
"14:23: " + getCheckMessage(MSG_KEY),
|
||||
"20:44: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig, getPath("InputArrayTypeStyle.java"), expected);
|
||||
}
|
||||
|
|
@ -64,10 +65,10 @@ public class ArrayTypeStyleCheckTest
|
|||
createCheckConfig(ArrayTypeStyleCheck.class);
|
||||
checkConfig.addAttribute("javaStyle", "false");
|
||||
final String[] expected = {
|
||||
"13:16: Array brackets at illegal position.",
|
||||
"16:39: Array brackets at illegal position.",
|
||||
"22:18: Array brackets at illegal position.",
|
||||
"30:20: Array brackets at illegal position.",
|
||||
"13:16: " + getCheckMessage(MSG_KEY),
|
||||
"16:39: " + getCheckMessage(MSG_KEY),
|
||||
"22:18: " + getCheckMessage(MSG_KEY),
|
||||
"30:20: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig, getPath("InputArrayTypeStyle.java"), expected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import static com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck.MSG_KEY;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -31,8 +32,6 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
|||
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
||||
|
||||
public class AvoidEscapedUnicodeCharactersCheckTest extends BaseCheckTestSupport {
|
||||
private final String msg = getCheckMessage("forbid.escaped.unicode.char");
|
||||
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("checks" + File.separator + filename);
|
||||
|
|
@ -54,32 +53,32 @@ public class AvoidEscapedUnicodeCharactersCheckTest extends BaseCheckTestSupport
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(AvoidEscapedUnicodeCharactersCheck.class);
|
||||
final String[] expected = {
|
||||
"7: " + msg,
|
||||
"9: " + msg,
|
||||
"11: " + msg,
|
||||
"15: " + msg,
|
||||
"16: " + msg,
|
||||
"20: " + msg,
|
||||
"24: " + msg,
|
||||
"25: " + msg,
|
||||
"27: " + msg,
|
||||
"31: " + msg,
|
||||
"32: " + msg,
|
||||
"33: " + msg,
|
||||
"34: " + msg,
|
||||
"42: " + msg,
|
||||
"59: " + msg,
|
||||
"60: " + msg,
|
||||
"61: " + msg,
|
||||
"62: " + msg,
|
||||
"72: " + msg,
|
||||
"73: " + msg,
|
||||
"74: " + msg,
|
||||
"75: " + msg,
|
||||
"76: " + msg,
|
||||
"77: " + msg,
|
||||
"79: " + msg,
|
||||
"82: " + msg,
|
||||
"7: " + getCheckMessage(MSG_KEY),
|
||||
"9: " + getCheckMessage(MSG_KEY),
|
||||
"11: " + getCheckMessage(MSG_KEY),
|
||||
"15: " + getCheckMessage(MSG_KEY),
|
||||
"16: " + getCheckMessage(MSG_KEY),
|
||||
"20: " + getCheckMessage(MSG_KEY),
|
||||
"24: " + getCheckMessage(MSG_KEY),
|
||||
"25: " + getCheckMessage(MSG_KEY),
|
||||
"27: " + getCheckMessage(MSG_KEY),
|
||||
"31: " + getCheckMessage(MSG_KEY),
|
||||
"32: " + getCheckMessage(MSG_KEY),
|
||||
"33: " + getCheckMessage(MSG_KEY),
|
||||
"34: " + getCheckMessage(MSG_KEY),
|
||||
"42: " + getCheckMessage(MSG_KEY),
|
||||
"59: " + getCheckMessage(MSG_KEY),
|
||||
"60: " + getCheckMessage(MSG_KEY),
|
||||
"61: " + getCheckMessage(MSG_KEY),
|
||||
"62: " + getCheckMessage(MSG_KEY),
|
||||
"72: " + getCheckMessage(MSG_KEY),
|
||||
"73: " + getCheckMessage(MSG_KEY),
|
||||
"74: " + getCheckMessage(MSG_KEY),
|
||||
"75: " + getCheckMessage(MSG_KEY),
|
||||
"76: " + getCheckMessage(MSG_KEY),
|
||||
"77: " + getCheckMessage(MSG_KEY),
|
||||
"79: " + getCheckMessage(MSG_KEY),
|
||||
"82: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidEscapedUnicodeCharacters.java"), expected);
|
||||
}
|
||||
|
|
@ -90,29 +89,29 @@ public class AvoidEscapedUnicodeCharactersCheckTest extends BaseCheckTestSupport
|
|||
createCheckConfig(AvoidEscapedUnicodeCharactersCheck.class);
|
||||
checkConfig.addAttribute("allowEscapesForControlCharacters", "true");
|
||||
final String[] expected = {
|
||||
"7: " + msg,
|
||||
"9: " + msg,
|
||||
"11: " + msg,
|
||||
"15: " + msg,
|
||||
"16: " + msg,
|
||||
"24: " + msg,
|
||||
"25: " + msg,
|
||||
"31: " + msg,
|
||||
"32: " + msg,
|
||||
"33: " + msg,
|
||||
"34: " + msg,
|
||||
"42: " + msg,
|
||||
"59: " + msg,
|
||||
"60: " + msg,
|
||||
"61: " + msg,
|
||||
"62: " + msg,
|
||||
"73: " + msg,
|
||||
"74: " + msg,
|
||||
"75: " + msg,
|
||||
"76: " + msg,
|
||||
"77: " + msg,
|
||||
"79: " + msg,
|
||||
"82: " + msg,
|
||||
"7: " + getCheckMessage(MSG_KEY),
|
||||
"9: " + getCheckMessage(MSG_KEY),
|
||||
"11: " + getCheckMessage(MSG_KEY),
|
||||
"15: " + getCheckMessage(MSG_KEY),
|
||||
"16: " + getCheckMessage(MSG_KEY),
|
||||
"24: " + getCheckMessage(MSG_KEY),
|
||||
"25: " + getCheckMessage(MSG_KEY),
|
||||
"31: " + getCheckMessage(MSG_KEY),
|
||||
"32: " + getCheckMessage(MSG_KEY),
|
||||
"33: " + getCheckMessage(MSG_KEY),
|
||||
"34: " + getCheckMessage(MSG_KEY),
|
||||
"42: " + getCheckMessage(MSG_KEY),
|
||||
"59: " + getCheckMessage(MSG_KEY),
|
||||
"60: " + getCheckMessage(MSG_KEY),
|
||||
"61: " + getCheckMessage(MSG_KEY),
|
||||
"62: " + getCheckMessage(MSG_KEY),
|
||||
"73: " + getCheckMessage(MSG_KEY),
|
||||
"74: " + getCheckMessage(MSG_KEY),
|
||||
"75: " + getCheckMessage(MSG_KEY),
|
||||
"76: " + getCheckMessage(MSG_KEY),
|
||||
"77: " + getCheckMessage(MSG_KEY),
|
||||
"79: " + getCheckMessage(MSG_KEY),
|
||||
"82: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidEscapedUnicodeCharacters.java"), expected);
|
||||
}
|
||||
|
|
@ -123,24 +122,24 @@ public class AvoidEscapedUnicodeCharactersCheckTest extends BaseCheckTestSupport
|
|||
createCheckConfig(AvoidEscapedUnicodeCharactersCheck.class);
|
||||
checkConfig.addAttribute("allowByTailComment", "true");
|
||||
final String[] expected = {
|
||||
"7: " + msg,
|
||||
"15: " + msg,
|
||||
"24: " + msg,
|
||||
"31: " + msg,
|
||||
"33: " + msg,
|
||||
"34: " + msg,
|
||||
"59: " + msg,
|
||||
"60: " + msg,
|
||||
"61: " + msg,
|
||||
"62: " + msg,
|
||||
"72: " + msg,
|
||||
"73: " + msg,
|
||||
"74: " + msg,
|
||||
"75: " + msg,
|
||||
"76: " + msg,
|
||||
"77: " + msg,
|
||||
"79: " + msg,
|
||||
"82: " + msg,
|
||||
"7: " + getCheckMessage(MSG_KEY),
|
||||
"15: " + getCheckMessage(MSG_KEY),
|
||||
"24: " + getCheckMessage(MSG_KEY),
|
||||
"31: " + getCheckMessage(MSG_KEY),
|
||||
"33: " + getCheckMessage(MSG_KEY),
|
||||
"34: " + getCheckMessage(MSG_KEY),
|
||||
"59: " + getCheckMessage(MSG_KEY),
|
||||
"60: " + getCheckMessage(MSG_KEY),
|
||||
"61: " + getCheckMessage(MSG_KEY),
|
||||
"62: " + getCheckMessage(MSG_KEY),
|
||||
"72: " + getCheckMessage(MSG_KEY),
|
||||
"73: " + getCheckMessage(MSG_KEY),
|
||||
"74: " + getCheckMessage(MSG_KEY),
|
||||
"75: " + getCheckMessage(MSG_KEY),
|
||||
"76: " + getCheckMessage(MSG_KEY),
|
||||
"77: " + getCheckMessage(MSG_KEY),
|
||||
"79: " + getCheckMessage(MSG_KEY),
|
||||
"82: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidEscapedUnicodeCharacters.java"), expected);
|
||||
}
|
||||
|
|
@ -151,15 +150,15 @@ public class AvoidEscapedUnicodeCharactersCheckTest extends BaseCheckTestSupport
|
|||
createCheckConfig(AvoidEscapedUnicodeCharactersCheck.class);
|
||||
checkConfig.addAttribute("allowIfAllCharactersEscaped", "true");
|
||||
final String[] expected = {
|
||||
"7: " + msg,
|
||||
"9: " + msg,
|
||||
"11: " + msg,
|
||||
"15: " + msg,
|
||||
"16: " + msg,
|
||||
"31: " + msg,
|
||||
"32: " + msg,
|
||||
"33: " + msg,
|
||||
"42: " + msg,
|
||||
"7: " + getCheckMessage(MSG_KEY),
|
||||
"9: " + getCheckMessage(MSG_KEY),
|
||||
"11: " + getCheckMessage(MSG_KEY),
|
||||
"15: " + getCheckMessage(MSG_KEY),
|
||||
"16: " + getCheckMessage(MSG_KEY),
|
||||
"31: " + getCheckMessage(MSG_KEY),
|
||||
"32: " + getCheckMessage(MSG_KEY),
|
||||
"33: " + getCheckMessage(MSG_KEY),
|
||||
"42: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidEscapedUnicodeCharacters.java"), expected);
|
||||
}
|
||||
|
|
@ -170,18 +169,18 @@ public class AvoidEscapedUnicodeCharactersCheckTest extends BaseCheckTestSupport
|
|||
createCheckConfig(AvoidEscapedUnicodeCharactersCheck.class);
|
||||
checkConfig.addAttribute("allowNonPrintableEscapes", "true");
|
||||
final String[] expected = {
|
||||
"7: " + msg,
|
||||
"9: " + msg,
|
||||
"11: " + msg,
|
||||
"15: " + msg,
|
||||
"16: " + msg,
|
||||
"24: " + msg,
|
||||
"25: " + msg,
|
||||
"31: " + msg,
|
||||
"32: " + msg,
|
||||
"33: " + msg,
|
||||
"34: " + msg,
|
||||
"42: " + msg,
|
||||
"7: " + getCheckMessage(MSG_KEY),
|
||||
"9: " + getCheckMessage(MSG_KEY),
|
||||
"11: " + getCheckMessage(MSG_KEY),
|
||||
"15: " + getCheckMessage(MSG_KEY),
|
||||
"16: " + getCheckMessage(MSG_KEY),
|
||||
"24: " + getCheckMessage(MSG_KEY),
|
||||
"25: " + getCheckMessage(MSG_KEY),
|
||||
"31: " + getCheckMessage(MSG_KEY),
|
||||
"32: " + getCheckMessage(MSG_KEY),
|
||||
"33: " + getCheckMessage(MSG_KEY),
|
||||
"34: " + getCheckMessage(MSG_KEY),
|
||||
"42: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidEscapedUnicodeCharacters.java"), expected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.checks;
|
||||
|
||||
import static com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck.MSG_KEY;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -108,7 +109,7 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport {
|
|||
public void testWrongDefault() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class);
|
||||
final String[] expected = {
|
||||
"4: " + getCheckMessage("type.file.mismatch"),
|
||||
"4: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
verify(checkConfig, getPath("InputOuterTypeFilename5.java"), expected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.checks.annotation;
|
||||
|
||||
import static com.puppycrawl.tools.checkstyle.checks.annotation.PackageAnnotationCheck.MSG_KEY;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
@ -77,7 +79,7 @@ public class PackageAnnotationCheckTest extends BaseCheckTestSupport {
|
|||
final DefaultConfiguration checkConfig = createCheckConfig(PackageAnnotationCheck.class);
|
||||
|
||||
final String[] expected = {
|
||||
"0: Package annotations must be in the package-info.java info.",
|
||||
"0: " + getCheckMessage(MSG_KEY),
|
||||
};
|
||||
|
||||
verify(checkConfig, getNonCompilablePath("InputPackageAnnotation2.java"), expected);
|
||||
|
|
|
|||
Loading…
Reference in New Issue