From 8dd7a39b3c5984d3c176d3afc342d411cf65681b Mon Sep 17 00:00:00 2001 From: Shashwat Jaiswal Date: Wed, 4 Aug 2021 17:19:03 +0530 Subject: [PATCH] Issue #10543: Update inputs for RecordComponentNameCheckTest --- .../naming/RecordComponentNameCheckTest.java | 16 ++++++++-------- .../InputRecordComponentNameDefault.java | 9 +++++++-- .../InputRecordComponentNameLowercase.java | 10 +++++++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/RecordComponentNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/RecordComponentNameCheckTest.java index 60e7d129b89..74b35e75e9a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/RecordComponentNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/RecordComponentNameCheckTest.java @@ -53,10 +53,10 @@ public void testRecordDefault() final String pattern = "^[a-z][a-zA-Z0-9]*$"; final String[] expected = { - "14:34: " + getCheckMessage(MSG_INVALID_PATTERN, "value_123", pattern), - "15:15: " + getCheckMessage(MSG_INVALID_PATTERN, "Values", pattern), - "18:35: " + getCheckMessage(MSG_INVALID_PATTERN, "_value123", pattern), - "19:9: " + getCheckMessage(MSG_INVALID_PATTERN, "$age", pattern), + "19:34: " + getCheckMessage(MSG_INVALID_PATTERN, "value_123", pattern), + "20:15: " + getCheckMessage(MSG_INVALID_PATTERN, "Values", pattern), + "23:35: " + getCheckMessage(MSG_INVALID_PATTERN, "_value123", pattern), + "24:9: " + getCheckMessage(MSG_INVALID_PATTERN, "$age", pattern), }; verify(checkConfig, getNonCompilablePath("InputRecordComponentNameDefault.java"), expected); @@ -72,10 +72,10 @@ public void testClassFooName() final String pattern = "^[a-z0-9]+$"; final String[] expected = { - "15:36: " + getCheckMessage(MSG_INVALID_PATTERN, "value_123", pattern), - "16:15: " + getCheckMessage(MSG_INVALID_PATTERN, "Values", pattern), - "19:37: " + getCheckMessage(MSG_INVALID_PATTERN, "V", pattern), - "20:9: " + getCheckMessage(MSG_INVALID_PATTERN, "$age", pattern), + "19:36: " + getCheckMessage(MSG_INVALID_PATTERN, "value_123", pattern), + "20:15: " + getCheckMessage(MSG_INVALID_PATTERN, "Values", pattern), + "23:37: " + getCheckMessage(MSG_INVALID_PATTERN, "V", pattern), + "24:9: " + getCheckMessage(MSG_INVALID_PATTERN, "$age", pattern), }; verify(checkConfig, getNonCompilablePath("InputRecordComponentNameLowercase.java"), expected); diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/recordcomponentname/InputRecordComponentNameDefault.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/recordcomponentname/InputRecordComponentNameDefault.java index 3eb87b42bd8..49dab5b0053 100644 --- a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/recordcomponentname/InputRecordComponentNameDefault.java +++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/recordcomponentname/InputRecordComponentNameDefault.java @@ -1,3 +1,10 @@ +/* +RecordComponentName +format = (default)^[a-z][a-zA-Z0-9]*$ + + +*/ + //non-compiled with javac: Compilable with Java14 package com.puppycrawl.tools.checkstyle.checks.naming.recordcomponentname; @@ -6,8 +13,6 @@ import org.w3c.dom.Node; -/* Config: default - */ public record InputRecordComponentNameDefault(int x, String str, Double myValue1, int i1) { // ok } diff --git a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/recordcomponentname/InputRecordComponentNameLowercase.java b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/recordcomponentname/InputRecordComponentNameLowercase.java index 99155776f23..219701776cd 100644 --- a/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/recordcomponentname/InputRecordComponentNameLowercase.java +++ b/src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/recordcomponentname/InputRecordComponentNameLowercase.java @@ -1,3 +1,10 @@ +/* +RecordComponentName +format = ^[a-z\\d]+$ + + +*/ + //non-compiled with javac: Compilable with Java14 package com.puppycrawl.tools.checkstyle.checks.naming.recordcomponentname; @@ -6,9 +13,6 @@ import org.w3c.dom.Node; -/* Config: - * pattern = "^[a-z\\d]+$" - */ public record InputRecordComponentNameLowercase(Integer x, String str, Double val123) { // ok }