diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheckTest.java index 0f10f694d81..3c2e0b3f788 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheckTest.java @@ -53,15 +53,15 @@ public void testDefault() throws Exception { final String pattern = "^[a-z][a-zA-Z0-9]*$"; final String[] expected = { - "15:39: " + getCheckMessage(MSG_INVALID_PATTERN, "OTHER", pattern), - "25:34: " + getCheckMessage(MSG_INVALID_PATTERN, "Count", pattern), - "40:36: " + getCheckMessage(MSG_INVALID_PATTERN, "S", pattern), - "41:42: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), - "44:34: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), - "45:43: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), - "57:37: " + getCheckMessage(MSG_INVALID_PATTERN, "INTEGER", pattern), - "63:43: " + getCheckMessage(MSG_INVALID_PATTERN, "Thing1", pattern), - "67:41: " + getCheckMessage(MSG_INVALID_PATTERN, "Thing2", pattern), + "18:39: " + getCheckMessage(MSG_INVALID_PATTERN, "OTHER", pattern), + "28:34: " + getCheckMessage(MSG_INVALID_PATTERN, "Count", pattern), + "43:36: " + getCheckMessage(MSG_INVALID_PATTERN, "S", pattern), + "44:42: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), + "47:34: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), + "48:43: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), + "60:37: " + getCheckMessage(MSG_INVALID_PATTERN, "INTEGER", pattern), + "66:43: " + getCheckMessage(MSG_INVALID_PATTERN, "Thing1", pattern), + "70:41: " + getCheckMessage(MSG_INVALID_PATTERN, "Thing2", pattern), }; verify(checkConfig, getNonCompilablePath( @@ -78,24 +78,24 @@ public void testPatternVariableNameNoSingleChar() throws Exception { final String pattern = "^[a-z][a-zA-Z0-9]+$"; final String[] expected = { - "15:39: " + getCheckMessage(MSG_INVALID_PATTERN, "OTHER", pattern), - "20:33: " + getCheckMessage(MSG_INVALID_PATTERN, "s", pattern), - "25:34: " + getCheckMessage(MSG_INVALID_PATTERN, "Count", pattern), - "40:36: " + getCheckMessage(MSG_INVALID_PATTERN, "S", pattern), - "41:42: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), - "43:34: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), - "44:43: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), - "46:57: " + getCheckMessage(MSG_INVALID_PATTERN, "s", pattern), - "53:48: " + getCheckMessage(MSG_INVALID_PATTERN, "a", pattern), - "54:39: " + getCheckMessage(MSG_INVALID_PATTERN, "x", pattern), - "55:43: " + getCheckMessage(MSG_INVALID_PATTERN, "y", pattern), - "57:37: " + getCheckMessage(MSG_INVALID_PATTERN, "INTEGER", pattern), - "62:43: " + getCheckMessage(MSG_INVALID_PATTERN, "Thing1", pattern), - "66:41: " + getCheckMessage(MSG_INVALID_PATTERN, "Thing2", pattern), - "71:38: " + getCheckMessage(MSG_INVALID_PATTERN, "j", pattern), - "72:36: " + getCheckMessage(MSG_INVALID_PATTERN, "j", pattern), - "73:37: " + getCheckMessage(MSG_INVALID_PATTERN, "j", pattern), - "80:41: " + getCheckMessage(MSG_INVALID_PATTERN, "s", pattern), + "18:39: " + getCheckMessage(MSG_INVALID_PATTERN, "OTHER", pattern), + "23:33: " + getCheckMessage(MSG_INVALID_PATTERN, "s", pattern), + "28:34: " + getCheckMessage(MSG_INVALID_PATTERN, "Count", pattern), + "43:36: " + getCheckMessage(MSG_INVALID_PATTERN, "S", pattern), + "44:42: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), + "46:34: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), + "47:43: " + getCheckMessage(MSG_INVALID_PATTERN, "STRING", pattern), + "49:57: " + getCheckMessage(MSG_INVALID_PATTERN, "s", pattern), + "56:48: " + getCheckMessage(MSG_INVALID_PATTERN, "a", pattern), + "57:39: " + getCheckMessage(MSG_INVALID_PATTERN, "x", pattern), + "58:43: " + getCheckMessage(MSG_INVALID_PATTERN, "y", pattern), + "60:37: " + getCheckMessage(MSG_INVALID_PATTERN, "INTEGER", pattern), + "65:43: " + getCheckMessage(MSG_INVALID_PATTERN, "Thing1", pattern), + "69:41: " + getCheckMessage(MSG_INVALID_PATTERN, "Thing2", pattern), + "74:38: " + getCheckMessage(MSG_INVALID_PATTERN, "j", pattern), + "75:36: " + getCheckMessage(MSG_INVALID_PATTERN, "j", pattern), + "76:37: " + getCheckMessage(MSG_INVALID_PATTERN, "j", pattern), + "83:41: " + getCheckMessage(MSG_INVALID_PATTERN, "s", pattern), }; verify(checkConfig, diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/patternvariablename/InputPatternVariableNameEnhancedInstanceofNoSingleChar.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/patternvariablename/InputPatternVariableNameEnhancedInstanceofNoSingleChar.java index 49b2eeba00b..fa921d7dbcb 100644 --- a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/patternvariablename/InputPatternVariableNameEnhancedInstanceofNoSingleChar.java +++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/patternvariablename/InputPatternVariableNameEnhancedInstanceofNoSingleChar.java @@ -1,13 +1,16 @@ +/* +PatternVariableName +format = (default)^[a-z][a-zA-Z0-9]*$ + + +*/ + //non-compiled with javac: Compilable with Java14 package com.puppycrawl.tools.checkstyle.checks.naming.patternvariablename; import java.util.ArrayList; import java.util.Locale; -/* - * Config: - * tokens = PATTERN_VARIABLE_DEF - * format = "^[a-z][a-zA-Z0-9]+$" - */ + public class InputPatternVariableNameEnhancedInstanceofNoSingleChar { private Object obj; diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/patternvariablename/InputPatternVariableNameEnhancedInstanceofTestDefault.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/patternvariablename/InputPatternVariableNameEnhancedInstanceofTestDefault.java index d554b9aa403..9bb742c1ec3 100644 --- a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/patternvariablename/InputPatternVariableNameEnhancedInstanceofTestDefault.java +++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/patternvariablename/InputPatternVariableNameEnhancedInstanceofTestDefault.java @@ -1,13 +1,16 @@ +/* +PatternVariableName +format = (default)^[a-z][a-zA-Z0-9]*$ + + +*/ + //non-compiled with javac: Compilable with Java14 package com.puppycrawl.tools.checkstyle.checks.naming.patternvariablename; import java.util.ArrayList; import java.util.Locale; -/* - * Config: - * tokens = PATTERN_VARIABLE_DEF - * format = "^[a-z][a-zA-Z0-9]*$" - */ + public class InputPatternVariableNameEnhancedInstanceofTestDefault { private Object obj;