Skip to content

Commit

Permalink
Issue checkstyle#14715: Enforce new naming convention on Abbreviation…
Browse files Browse the repository at this point in the history
…AsWordInName in IT area
  • Loading branch information
Lmh-java committed Mar 28, 2024
1 parent f4b7158 commit 646ce60
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testAnnotation() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation.java"));
"InputXpathAbbreviationAsWordInNameAnnotation.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -52,7 +52,7 @@ public void testAnnotation() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation']]"
+ "@text='InputXpathAbbreviationAsWordInNameAnnotation']]"
+ "/OBJBLOCK/ANNOTATION_DEF/IDENT[@text='ANNOTATION']"
);

Expand All @@ -63,7 +63,7 @@ public void testAnnotation() throws Exception {
@Test
public void testAnnotationField() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField.java"));
"InputXpathAbbreviationAsWordInNameAnnotationField.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -75,7 +75,7 @@ public void testAnnotationField() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/ANNOTATION_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField']]"
+ "@text='InputXpathAbbreviationAsWordInNameAnnotationField']]"
+ "/OBJBLOCK/ANNOTATION_FIELD_DEF/IDENT[@text='ANNOTATION_FIELD']"
);

Expand All @@ -86,7 +86,7 @@ public void testAnnotationField() throws Exception {
@Test
public void testClass() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameClass.java"));
"InputXpathAbbreviationAsWordInNameClass.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -98,7 +98,7 @@ public void testClass() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameClass']]"
+ "@text='InputXpathAbbreviationAsWordInNameClass']]"
+ "/OBJBLOCK/CLASS_DEF/IDENT[@text='CLASS']"
);

Expand All @@ -109,7 +109,7 @@ public void testClass() throws Exception {
@Test
public void testEnum() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameEnum.java"));
"InputXpathAbbreviationAsWordInNameEnum.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -121,7 +121,7 @@ public void testEnum() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameEnum']]"
+ "@text='InputXpathAbbreviationAsWordInNameEnum']]"
+ "/OBJBLOCK/ENUM_DEF/IDENT[@text='ENUMERATION']"
);

Expand All @@ -132,7 +132,7 @@ public void testEnum() throws Exception {
@Test
public void testField() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameField.java"));
"InputXpathAbbreviationAsWordInNameField.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -144,7 +144,7 @@ public void testField() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameField']]"
+ "@text='InputXpathAbbreviationAsWordInNameField']]"
+ "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='FIELD']"
);

Expand All @@ -155,7 +155,7 @@ public void testField() throws Exception {
@Test
public void testInterface() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameInterface.java"));
"InputXpathAbbreviationAsWordInNameInterface.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -167,7 +167,7 @@ public void testInterface() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameInterface']]"
+ "@text='InputXpathAbbreviationAsWordInNameInterface']]"
+ "/OBJBLOCK/INTERFACE_DEF/IDENT[@text='INTERFACE']"
);

Expand All @@ -178,7 +178,7 @@ public void testInterface() throws Exception {
@Test
public void testMethod() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameMethod.java"));
"InputXpathAbbreviationAsWordInNameMethod.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -190,7 +190,7 @@ public void testMethod() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameMethod']]"
+ "@text='InputXpathAbbreviationAsWordInNameMethod']]"
+ "/OBJBLOCK/METHOD_DEF/IDENT[@text='METHOD']"
);

Expand All @@ -201,7 +201,7 @@ public void testMethod() throws Exception {
@Test
public void testParameter() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameParameter.java"));
"InputXpathAbbreviationAsWordInNameParameter.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -213,7 +213,7 @@ public void testParameter() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameParameter']]"
+ "@text='InputXpathAbbreviationAsWordInNameParameter']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]"
+ "/PARAMETERS/PARAMETER_DEF/IDENT[@text='PARAMETER']"
);
Expand All @@ -225,7 +225,7 @@ public void testParameter() throws Exception {
@Test
public void testVariable() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAbbreviationAsWordInNameVariable.java"));
"InputXpathAbbreviationAsWordInNameVariable.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AbbreviationAsWordInNameCheck.class);
Expand All @@ -237,7 +237,7 @@ public void testVariable() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionAbbreviationAsWordInNameVariable']]"
+ "@text='InputXpathAbbreviationAsWordInNameVariable']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]"
+ "/SLIST/VARIABLE_DEF/IDENT[@text='VARIABLE']"
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public class SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation {
public class InputXpathAbbreviationAsWordInNameAnnotation {

@interface ANNOTATION { // warn

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public @interface SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField {
public @interface InputXpathAbbreviationAsWordInNameAnnotationField {

String ANNOTATION_FIELD(); // warn

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public class SuppressionXpathRegressionAbbreviationAsWordInNameClass {
public class InputXpathAbbreviationAsWordInNameClass {

class CLASS { // warn

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public class SuppressionXpathRegressionAbbreviationAsWordInNameEnum {
public class InputXpathAbbreviationAsWordInNameEnum {

enum ENUMERATION { // warn

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public class SuppressionXpathRegressionAbbreviationAsWordInNameField {
public class InputXpathAbbreviationAsWordInNameField {

int FIELD; // warn

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public class SuppressionXpathRegressionAbbreviationAsWordInNameInterface {
public class InputXpathAbbreviationAsWordInNameInterface {

interface INTERFACE { // warn

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public interface SuppressionXpathRegressionAbbreviationAsWordInNameMethod {
public interface InputXpathAbbreviationAsWordInNameMethod {

void METHOD(); // warn

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public interface SuppressionXpathRegressionAbbreviationAsWordInNameParameter {
public interface InputXpathAbbreviationAsWordInNameParameter {

void method(int PARAMETER); // warn

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname;

public class SuppressionXpathRegressionAbbreviationAsWordInNameVariable {
public class InputXpathAbbreviationAsWordInNameVariable {

void method() {
int VARIABLE; // warn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ public class XpathRegressionTest extends AbstractModuleTestSupport {
// Checks whose files need to be renamed to new pattern "InputXpath{Check}Xxx.java"
// until https://github.com/checkstyle/checkstyle/issues/14715
private static final Set<String> RENAME_INPUT_XPATH = Set.of(
"AbbreviationAsWordInName",
"AbstractClassName",
"AnnotationLocation",
"AnnotationOnSameLine",
Expand Down

0 comments on commit 646ce60

Please sign in to comment.