Skip to content

Commit

Permalink
Issue #14715: Enforced new naming convention in IT area 15
Browse files Browse the repository at this point in the history
  • Loading branch information
MANISH-K-07 authored and rnveach committed Apr 18, 2024
1 parent aadc8f8 commit ca24f63
Show file tree
Hide file tree
Showing 22 changed files with 69 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testOne() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCustomImportOrderOne.java"));
new File(getPath("InputXpathCustomImportOrderOne.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CustomImportOrderCheck.class);
Expand All @@ -64,7 +64,7 @@ public void testOne() throws Exception {
@Test
public void testTwo() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCustomImportOrderTwo.java"));
new File(getPath("InputXpathCustomImportOrderTwo.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CustomImportOrderCheck.class);
Expand All @@ -86,7 +86,7 @@ public void testTwo() throws Exception {
@Test
public void testThree() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCustomImportOrderThree.java"));
new File(getPath("InputXpathCustomImportOrderThree.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CustomImportOrderCheck.class);
Expand All @@ -108,7 +108,7 @@ public void testThree() throws Exception {
@Test
public void testFour() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCustomImportOrderFour.java"));
new File(getPath("InputXpathCustomImportOrderFour.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CustomImportOrderCheck.class);
Expand All @@ -131,7 +131,7 @@ public void testFour() throws Exception {
@Test
public void testFive() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCustomImportOrderFive.java"));
new File(getPath("InputXpathCustomImportOrderFive.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CustomImportOrderCheck.class);
Expand All @@ -154,7 +154,7 @@ public void testFive() throws Exception {
@Test
public void testSix() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCustomImportOrderSix.java"));
new File(getPath("InputXpathCustomImportOrderSix.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CustomImportOrderCheck.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testConditionals() throws Exception {

final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCyclomaticComplexityOne.java"));
new File(getPath("InputXpathCyclomaticComplexityConditionals.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CyclomaticComplexityCheck.class);
Expand All @@ -54,13 +54,13 @@ public void testOne() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityOne']]"
+ "[./IDENT[@text='InputXpathCyclomaticComplexityConditionals']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityOne']]"
+ "[./IDENT[@text='InputXpathCyclomaticComplexityConditionals']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityOne']]"
+ "[./IDENT[@text='InputXpathCyclomaticComplexityConditionals']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS/LITERAL_PUBLIC"
);

Expand All @@ -69,9 +69,9 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testSwitchBlock() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCyclomaticComplexityTwo.java"));
new File(getPath("InputXpathCyclomaticComplexitySwitchBlock.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CyclomaticComplexityCheck.class);
Expand All @@ -84,13 +84,13 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityTwo']]"
+ "[./IDENT[@text='InputXpathCyclomaticComplexitySwitchBlock']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo2']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityTwo']]"
+ "[./IDENT[@text='InputXpathCyclomaticComplexitySwitchBlock']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo2']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityTwo']]"
+ "[./IDENT[@text='InputXpathCyclomaticComplexitySwitchBlock']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo2']]/MODIFIERS/LITERAL_PUBLIC"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testMethodDef() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable1.java"));
File(getPath("InputXpathFinalLocalVariableMethodDef.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);

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

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionFinalLocalVariable1']]"
+ "[@text='InputXpathFinalLocalVariableMethodDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]"
+ "/SLIST/VARIABLE_DEF/IDENT[@text='x']"
);
Expand All @@ -59,9 +59,9 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testForLoop() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable2.java"));
File(getPath("InputXpathFinalLocalVariableForLoop.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);

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

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionFinalLocalVariable2']]"
+ "[@text='InputXpathFinalLocalVariableForLoop']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]/SLIST/"
+ "LITERAL_FOR/SLIST/VARIABLE_DEF/IDENT[@text='x']"
);
Expand All @@ -81,9 +81,9 @@ public void testTwo() throws Exception {
}

@Test
public void testThree() throws Exception {
public void testSwitchCase() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable3.java"));
File(getPath("InputXpathFinalLocalVariableSwitchCase.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);

Expand All @@ -94,7 +94,7 @@ public void testThree() throws Exception {

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionFinalLocalVariable3']]"
+ "[@text='InputXpathFinalLocalVariableSwitchCase']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/"
+ "LITERAL_SWITCH/CASE_GROUP/SLIST/VARIABLE_DEF/IDENT[@text='foo']"
Expand All @@ -104,9 +104,9 @@ public void testThree() throws Exception {
}

@Test
public void testFour() throws Exception {
public void testInnerClass() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable4.java"));
File(getPath("InputXpathFinalLocalVariableInnerClass.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);

Expand All @@ -117,7 +117,7 @@ public void testFour() throws Exception {

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionFinalLocalVariable4']]"
+ "[@text='InputXpathFinalLocalVariableInnerClass']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test1']]"
+ "/SLIST/VARIABLE_DEF/IDENT[@text='shouldBeFinal']"
Expand All @@ -127,9 +127,9 @@ public void testFour() throws Exception {
}

@Test
public void testFive() throws Exception {
public void testParameterDef() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable5.java"));
File(getPath("InputXpathFinalLocalVariableParameterDef.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);
moduleConfig.addProperty("tokens", "PARAMETER_DEF");
Expand All @@ -141,7 +141,7 @@ public void testFive() throws Exception {

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionFinalLocalVariable5']]"
+ "[@text='InputXpathFinalLocalVariableParameterDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]"
+ "/PARAMETERS/PARAMETER_DEF/IDENT[@text='aArg']"
);
Expand All @@ -150,9 +150,9 @@ public void testFive() throws Exception {
}

@Test
public void testSix() throws Exception {
public void testEnhancedFor() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable6.java"));
File(getPath("InputXpathFinalLocalVariableEnhancedFor.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);
moduleConfig.addProperty("validateEnhancedForLoopVariable", "true");
Expand All @@ -164,7 +164,7 @@ public void testSix() throws Exception {

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionFinalLocalVariable6']]"
+ "[./IDENT[@text='InputXpathFinalLocalVariableEnhancedFor']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method1']]"
+ "/SLIST/LITERAL_FOR/FOR_EACH_CLAUSE/VARIABLE_DEF/IDENT[@text='a']"
);
Expand All @@ -173,33 +173,33 @@ public void testSix() throws Exception {
}

@Test
public void testSeven() throws Exception {
public void testCtor() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable7.java"));
File(getPath("InputXpathFinalLocalVariableCtor.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);
moduleConfig.addProperty("tokens", "PARAMETER_DEF");

final String[] expectedViolation = {
"4:55: " + getCheckMessage(FinalLocalVariableCheck.class,
"4:42: " + getCheckMessage(FinalLocalVariableCheck.class,
FinalLocalVariableCheck.MSG_KEY, "a"),
};

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionFinalLocalVariable7']]"
+ "[./IDENT[@text='InputXpathFinalLocalVariableCtor']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionFinalLocalVariable7']]"
+ "[@text='InputXpathFinalLocalVariableCtor']]"
+ "/PARAMETERS/PARAMETER_DEF/IDENT[@text='a']"
);

runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries);
}

@Test
public void testEight() throws Exception {
public void testTryBlock() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable8.java"));
File(getPath("InputXpathFinalLocalVariableTryBlock.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);

Expand All @@ -210,7 +210,7 @@ public void testEight() throws Exception {

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionFinalLocalVariable8']]"
+ "[@text='InputXpathFinalLocalVariableTryBlock']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkCodeBlock']]"
+ "/SLIST/LITERAL_TRY/SLIST/VARIABLE_DEF/IDENT[@text='start']"
);
Expand All @@ -219,9 +219,9 @@ public void testEight() throws Exception {
}

@Test
public void testNine() throws Exception {
public void testConditionals() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionFinalLocalVariable9.java"));
File(getPath("InputXpathFinalLocalVariableConditionals.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class);

Expand All @@ -232,7 +232,7 @@ public void testNine() throws Exception {

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionFinalLocalVariable9']]"
+ "[./IDENT[@text='InputXpathFinalLocalVariableConditionals']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkCodeBlock']]/SLIST/LITERAL_TRY"
+ "/SLIST/LITERAL_IF/LITERAL_ELSE/LITERAL_IF"
+ "/SLIST/VARIABLE_DEF/IDENT[@text='body']"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.checkstyle.suppressionxpathfilter.customimportorder;

import static java.util.Arrays.sort;
import static java.lang.Math.PI; // warn

import java.io.File;
import java.io.FileInputStream;
import static java.lang.Math.PI; // warn
import java.util.HashMap;
import java.util.Scanner;

public class SuppressionXpathRegressionCustomImportOrderOne {
public class InputXpathCustomImportOrderFive {
// code
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
import java.util.HashMap;
import java.util.Scanner;

public class SuppressionXpathRegressionCustomImportOrderFour {
public class InputXpathCustomImportOrderFour {
// code
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.checkstyle.suppressionxpathfilter.customimportorder;

import static java.util.Arrays.sort;
import static java.lang.Math.PI; // warn

import java.io.File;
import java.io.FileInputStream;
import static java.lang.Math.PI; // warn
import java.util.HashMap;
import java.util.Scanner;

public class SuppressionXpathRegressionCustomImportOrderFive {
public class InputXpathCustomImportOrderOne {
// code
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
import java.util.HashMap;
import java.util.Scanner;

public class SuppressionXpathRegressionCustomImportOrderSix {
public class InputXpathCustomImportOrderSix {
// code
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
import java.util.HashMap;
import java.util.Scanner;

public class SuppressionXpathRegressionCustomImportOrderThree {
public class InputXpathCustomImportOrderThree {
// code
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
import java.util.HashMap;
import java.util.Scanner;

public class SuppressionXpathRegressionCustomImportOrderTwo {
public class InputXpathCustomImportOrderTwo {
// code
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.cyclomaticcomplexity;

public class SuppressionXpathRegressionCyclomaticComplexityOne {
public class InputXpathCyclomaticComplexityConditionals {
public void test(int a, int b) { //warn
if (a > b) {

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

public class SuppressionXpathRegressionCyclomaticComplexityTwo {
public class InputXpathCyclomaticComplexitySwitchBlock {


public void foo2() { //warn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.finallocalvariable;

public class SuppressionXpathRegressionFinalLocalVariable9 {
public class InputXpathFinalLocalVariableConditionals {
private void checkCodeBlock() {
try {

Expand Down

0 comments on commit ca24f63

Please sign in to comment.