Skip to content

Commit

Permalink
Issue #14715: Enforced new naming convention in IT area 14
Browse files Browse the repository at this point in the history
  • Loading branch information
MANISH-K-07 authored and rnveach committed Apr 13, 2024
1 parent 9c26348 commit 69337c7
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testThree() throws Exception {

final File fileToProcess =
new File(getNonCompilablePath("InputXpathPackageName.java"));
new File(getNonCompilablePath("InputXpathPackageNameThree.java"));

final String pattern = "^[a-z]+(\\.[a-z][a-z0-9]*)*$";

Expand All @@ -95,7 +95,7 @@ public void testTwo() throws Exception {
}

@Test
public void testThree() throws Exception {
public void testTwo() throws Exception {

final File fileToProcess =
new File(getPath("InputXpathPackageNameTwo.java"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testMethods() throws Exception {
final String filePath =
getPath("SuppressionXpathRegressionParameterAssignmentMethods.java");
getPath("InputXpathParameterAssignmentMethods.java");
final File fileToProcess = new File(filePath);

final DefaultConfiguration moduleConfig =
Expand All @@ -52,11 +52,11 @@ public void testMethods() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionParameterAssignmentMethods']]"
+ "@text='InputXpathParameterAssignmentMethods']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='Test1']]/SLIST/EXPR"
+ "[./PLUS_ASSIGN/IDENT[@text='field']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionParameterAssignmentMethods']]"
+ "@text='InputXpathParameterAssignmentMethods']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='Test1']]"
+ "/SLIST/EXPR/PLUS_ASSIGN[./IDENT[@text='field']]"
);
Expand All @@ -68,7 +68,7 @@ public void testMethods() throws Exception {
@Test
public void testLambdas() throws Exception {
final String filePath =
getPath("SuppressionXpathRegressionParameterAssignmentLambdas.java");
getPath("InputXpathParameterAssignmentLambdas.java");
final File fileToProcess = new File(filePath);

final DefaultConfiguration moduleConfig =
Expand All @@ -80,11 +80,11 @@ public void testLambdas() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionParameterAssignmentLambdas']]"
+ "@text='InputXpathParameterAssignmentLambdas']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='obj1']]"
+ "/ASSIGN/LAMBDA[./IDENT[@text='q']]/EXPR",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionParameterAssignmentLambdas']]"
+ "@text='InputXpathParameterAssignmentLambdas']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='obj1']]/ASSIGN/LAMBDA[./IDENT["
+ "@text='q']]/EXPR/POST_INC[./IDENT[@text='q']]"
);
Expand All @@ -95,7 +95,7 @@ public void testLambdas() throws Exception {
@Test
public void testCtor() throws Exception {
final String filePath =
getPath("SuppressionXpathRegressionParameterAssignmentCtor.java");
getPath("InputXpathParameterAssignmentCtor.java");
final File fileToProcess = new File(filePath);

final DefaultConfiguration moduleConfig =
Expand All @@ -107,14 +107,14 @@ public void testCtor() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionParameterAssignmentCtor']]"
+ "@text='InputXpathParameterAssignmentCtor']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionParameterAssignmentCtor']]"
+ "@text='InputXpathParameterAssignmentCtor']]"
+ "/SLIST/EXPR[./PLUS_ASSIGN/IDENT[@text='field']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionParameterAssignmentCtor']]"
+ "@text='InputXpathParameterAssignmentCtor']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionParameterAssignmentCtor']]"
+ "@text='InputXpathParameterAssignmentCtor']]"
+ "/SLIST/EXPR/PLUS_ASSIGN[./IDENT[@text='field']]"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected String getCheckName() {
@Test
public void testDefaultPattern() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParameterNameDefaultPattern.java"));
new File(getPath("InputXpathParameterNameDefaultPattern.java"));

final String pattern = "^[a-z][a-zA-Z0-9]*$";
final DefaultConfiguration moduleConfig =
Expand All @@ -55,7 +55,7 @@ public void testDefaultPattern() throws Exception {
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text"
+ "='SuppressionXpathRegressionParameterNameDefaultPattern']]"
+ "='InputXpathParameterNameDefaultPattern']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method1']]"
+ "/PARAMETERS/PARAMETER_DEF/IDENT[@text='v_1']"
);
Expand All @@ -66,7 +66,7 @@ public void testDefaultPattern() throws Exception {
@Test
public void testDifferentPattern() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParameterNameDifferentPattern.java"));
new File(getPath("InputXpathParameterNameDifferentPattern.java"));

final String pattern = "^[a-z][_a-zA-Z0-9]+$";
final DefaultConfiguration moduleConfig =
Expand All @@ -81,7 +81,7 @@ public void testDifferentPattern() throws Exception {
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text"
+ "='SuppressionXpathRegressionParameterNameDifferentPattern']]"
+ "='InputXpathParameterNameDifferentPattern']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]"
+ "/PARAMETERS/PARAMETER_DEF/IDENT[@text='V2']"
);
Expand All @@ -92,7 +92,7 @@ public void testDifferentPattern() throws Exception {
@Test
public void testIgnoreOverridden() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParameterNameIgnoreOverridden.java"));
new File(getPath("InputXpathParameterNameIgnoreOverridden.java"));

final String pattern = "^[a-z][a-zA-Z0-9]*$";
final DefaultConfiguration moduleConfig =
Expand All @@ -107,7 +107,7 @@ public void testIgnoreOverridden() throws Exception {
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text"
+ "='SuppressionXpathRegressionParameterNameIgnoreOverridden']]"
+ "='InputXpathParameterNameIgnoreOverridden']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]"
+ "/PARAMETERS/PARAMETER_DEF/IDENT[@text='V2']"
);
Expand All @@ -118,7 +118,7 @@ public void testIgnoreOverridden() throws Exception {
@Test
public void testAccessModifiers() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParameterNameAccessModifier.java"));
new File(getPath("InputXpathParameterNameAccessModifier.java"));

final String pattern = "^[a-z][a-z0-9][a-zA-Z0-9]*$";
final DefaultConfiguration moduleConfig =
Expand All @@ -134,7 +134,7 @@ public void testAccessModifiers() throws Exception {
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text"
+ "='SuppressionXpathRegressionParameterNameAccessModifier']]"
+ "='InputXpathParameterNameAccessModifier']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]"
+ "/PARAMETERS/PARAMETER_DEF/IDENT[@text='b']"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testDefault() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParameterNumberDefault.java"));
new File(getPath("InputXpathParameterNumberDefault.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(ParameterNumberCheck.class);

Expand All @@ -50,7 +50,7 @@ public void testDefault() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionParameterNumberDefault']]"
+ "[./IDENT[@text='InputXpathParameterNumberDefault']]"
+ "/OBJBLOCK/METHOD_DEF/IDENT[@text='myMethod']"
);

Expand All @@ -61,7 +61,7 @@ public void testDefault() throws Exception {
@Test
public void testMethods() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParameterNumberMethods.java"));
new File(getPath("InputXpathParameterNumberMethods.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(ParameterNumberCheck.class);
moduleConfig.addProperty("max", "10");
Expand All @@ -73,7 +73,7 @@ public void testMethods() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionParameterNumberMethods']]"
+ "[./IDENT[@text='InputXpathParameterNumberMethods']]"
+ "/OBJBLOCK/METHOD_DEF/IDENT[@text='myMethod']"
);

Expand All @@ -83,7 +83,7 @@ public void testMethods() throws Exception {
@Test
public void testIgnoreOverriddenMethods() throws Exception {
final String filePath =
getPath("SuppressionXpathRegressionParameterNumberIgnoreOverriddenMethods.java");
getPath("InputXpathParameterNumberIgnoreOverriddenMethods.java");
final File fileToProcess = new File(filePath);

final DefaultConfiguration moduleConfig = createModuleConfig(ParameterNumberCheck.class);
Expand All @@ -95,9 +95,9 @@ public void testIgnoreOverriddenMethods() throws Exception {

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

runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries);
Expand All @@ -106,7 +106,7 @@ public void testIgnoreOverriddenMethods() throws Exception {
@Test
public void testIgnoreAnnotatedBy() throws Exception {
final String filePath =
getPath("SuppressionXpathRegressionParameterNumberIgnoreAnnotatedBy.java");
getPath("InputXpathParameterNumberIgnoreAnnotatedBy.java");
final File fileToProcess = new File(filePath);

final DefaultConfiguration moduleConfig = createModuleConfig(ParameterNumberCheck.class);
Expand All @@ -119,7 +119,7 @@ public void testIgnoreAnnotatedBy() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionParameterNumberIgnoreAnnotatedBy']]"
+ "[./IDENT[@text='InputXpathParameterNumberIgnoreAnnotatedBy']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]"
+ "/OBJBLOCK/STATIC_INIT/SLIST/EXPR/LITERAL_NEW[./IDENT[@text='Object']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected String getCheckName() {
@Test
public void testLeftFollowed() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParenPadLeftFollowed.java"));
new File(getPath("InputXpathParenPadLeftFollowed.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(ParenPadCheck.class);
Expand All @@ -54,7 +54,7 @@ public void testLeftFollowed() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionParenPadLeftFollowed']]"
+ "[./IDENT[@text='InputXpathParenPadLeftFollowed']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_IF/LPAREN"
);

Expand All @@ -65,7 +65,7 @@ public void testLeftFollowed() throws Exception {
@Test
public void testLeftNotFollowed() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParenPadLeftNotFollowed.java"));
new File(getPath("InputXpathParenPadLeftNotFollowed.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(ParenPadCheck.class);
Expand All @@ -78,7 +78,7 @@ public void testLeftNotFollowed() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionParenPadLeftNotFollowed']]"
+ "[./IDENT[@text='InputXpathParenPadLeftNotFollowed']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_IF/LPAREN"
);

Expand All @@ -89,7 +89,7 @@ public void testLeftNotFollowed() throws Exception {
@Test
public void testRightPreceded() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParenPadRightPreceded.java"));
new File(getPath("InputXpathParenPadRightPreceded.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(ParenPadCheck.class);
Expand All @@ -101,7 +101,7 @@ public void testRightPreceded() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionParenPadRightPreceded']]"
+ "[./IDENT[@text='InputXpathParenPadRightPreceded']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_IF/RPAREN"
);

Expand All @@ -112,7 +112,7 @@ public void testRightPreceded() throws Exception {
@Test
public void testRightNotPreceded() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionParenPadRightNotPreceded.java"));
new File(getPath("InputXpathParenPadRightNotPreceded.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(ParenPadCheck.class);
Expand All @@ -125,7 +125,7 @@ public void testRightNotPreceded() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionParenPadRightNotPreceded']]"
+ "[./IDENT[@text='InputXpathParenPadRightNotPreceded']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_IF/RPAREN"
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.checkstyle.suppressionxpathfilter.PACKAGENAME; // warn

public class InputXpathPackageName {
public class InputXpathPackageNameThree {
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.checkstyle.suppressionxpathfilter.parameterassignment;

public class SuppressionXpathRegressionParameterAssignmentCtor {
public class InputXpathParameterAssignmentCtor {
int field;
SuppressionXpathRegressionParameterAssignmentCtor(int field) {
InputXpathParameterAssignmentCtor(int field) {
int i = field;
this.field = field;
i++;
field += 1; // warn
this.field++;
}
// without parameters
SuppressionXpathRegressionParameterAssignmentCtor() {
InputXpathParameterAssignmentCtor() {
field = 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.parameterassignment;

public class SuppressionXpathRegressionParameterAssignmentLambdas {
public class InputXpathParameterAssignmentLambdas {

public interface SomeInterface {
void method(int a);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.parameterassignment;

public class SuppressionXpathRegressionParameterAssignmentMethods {
public class InputXpathParameterAssignmentMethods {
int field;
void Test1(int field) {
int i = field;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.parametername;

class SuppressionXpathRegressionParameterNameAccessModifier {
class InputXpathParameterNameAccessModifier {

private void method1(int a) { // ok
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.parametername;

class SuppressionXpathRegressionParameterNameDefaultPattern {
class InputXpathParameterNameDefaultPattern {

void method1(int v_1) { // warn
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.parametername;

class SuppressionXpathRegressionParameterNameDifferentPattern {
class InputXpathParameterNameDifferentPattern {

void method2(int V2) { // warn
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.parametername;

class SuppressionXpathRegressionParameterNameIgnoreOverridden {
class InputXpathParameterNameIgnoreOverridden {

void method2(int V2) { // warn
}
Expand Down

0 comments on commit 69337c7

Please sign in to comment.