Skip to content

Commit

Permalink
Issue #14715: Enforced new naming convention in IT area Two
Browse files Browse the repository at this point in the history
  • Loading branch information
MANISH-K-07 authored and rnveach committed Mar 31, 2024
1 parent 4fe8118 commit 341cb5e
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testClassFields() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidDoubleBraceInitialization.java"));
getPath("InputXpathAvoidDoubleBraceInitializationClassFields.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(clazz);

Expand All @@ -51,11 +51,11 @@ public void testOne() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionAvoidDoubleBraceInitialization']]"
+ "[./IDENT[@text='InputXpathAvoidDoubleBraceInitializationClassFields']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='list']]/ASSIGN/EXPR/"
+ "LITERAL_NEW[./IDENT[@text='ArrayList']]/OBJBLOCK",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionAvoidDoubleBraceInitialization']]"
+ "[./IDENT[@text='InputXpathAvoidDoubleBraceInitializationClassFields']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='list']]/ASSIGN/EXPR/"
+ "LITERAL_NEW[./IDENT[@text='ArrayList']]/OBJBLOCK/LCURLY"
);
Expand All @@ -64,9 +64,9 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testMethodDef() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo.java"));
getPath("InputXpathAvoidDoubleBraceInitializationMethodDef.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(clazz);

Expand All @@ -76,12 +76,12 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo']]"
+ "'InputXpathAvoidDoubleBraceInitializationMethodDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/EXPR/LITERAL_NEW[./IDENT[@text='HashSet']]"
+ "/OBJBLOCK",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo']]"
+ "'InputXpathAvoidDoubleBraceInitializationMethodDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/EXPR/LITERAL_NEW[./IDENT[@text='HashSet']]"
+ "/OBJBLOCK/LCURLY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected String getCheckName() {
@Test
public void testDefault() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault.java"));
"InputXpathAvoidEscapedUnicodeCharactersDefault.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidEscapedUnicodeCharactersCheck.class);
Expand All @@ -52,11 +52,11 @@ public void testDefault() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault']]"
+ "[@text='InputXpathAvoidEscapedUnicodeCharactersDefault']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev2']]"
+ "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault']]"
+ "[@text='InputXpathAvoidEscapedUnicodeCharactersDefault']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev2']]"
+ "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']"
);
Expand All @@ -68,7 +68,7 @@ public void testDefault() throws Exception {
@Test
public void testControlCharacters() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters.java")
"InputXpathAvoidEscapedUnicodeCharactersControlCharacters.java")
);

final DefaultConfiguration moduleConfig =
Expand All @@ -82,12 +82,12 @@ public void testControlCharacters() throws Exception {
final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text="
+ "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters']]"
+ "'InputXpathAvoidEscapedUnicodeCharactersControlCharacters']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]"
+ "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]",
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text="
+ "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters']]"
+ "'InputXpathAvoidEscapedUnicodeCharactersControlCharacters']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]"
+ "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']"
);
Expand All @@ -99,7 +99,7 @@ public void testControlCharacters() throws Exception {
@Test
public void testTailComment() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment.java"));
"InputXpathAvoidEscapedUnicodeCharactersTailComment.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidEscapedUnicodeCharactersCheck.class);
Expand All @@ -112,12 +112,12 @@ public void testTailComment() throws Exception {
final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text="
+ "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment']]"
+ "'InputXpathAvoidEscapedUnicodeCharactersTailComment']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]"
+ "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]",
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text="
+ "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment']]"
+ "'InputXpathAvoidEscapedUnicodeCharactersTailComment']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]"
+ "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']"
);
Expand All @@ -129,7 +129,7 @@ public void testTailComment() throws Exception {
@Test
public void testAllCharactersEscaped() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped.java"));
"InputXpathAvoidEscapedUnicodeCharactersAllEscaped.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidEscapedUnicodeCharactersCheck.class);
Expand All @@ -142,12 +142,12 @@ public void testAllCharactersEscaped() throws Exception {
final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text="
+ "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped']]"
+ "'InputXpathAvoidEscapedUnicodeCharactersAllEscaped']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]"
+ "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]",
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text="
+ "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped']]"
+ "'InputXpathAvoidEscapedUnicodeCharactersAllEscaped']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]"
+ "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']"
);
Expand All @@ -159,7 +159,7 @@ public void testAllCharactersEscaped() throws Exception {
@Test
public void testNonPrintableCharacters() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable.java"));
"InputXpathAvoidEscapedUnicodeCharactersNonPrintable.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidEscapedUnicodeCharactersCheck.class);
Expand All @@ -172,12 +172,12 @@ public void testNonPrintableCharacters() throws Exception {
final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text="
+ "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable']]"
+ "'InputXpathAvoidEscapedUnicodeCharactersNonPrintable']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]"
+ "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]",
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text="
+ "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable']]"
+ "'InputXpathAvoidEscapedUnicodeCharactersNonPrintable']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]"
+ "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected String getCheckName() {
@Test
public void testInlineConditionalsVariableDef() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidInlineConditionalsVariableDef.java"));
getPath("InputXpathAvoidInlineConditionalsVariableDef.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidInlineConditionalsCheck.class);
Expand All @@ -51,11 +51,11 @@ public void testInlineConditionalsVariableDef() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='"
+ "SuppressionXpathRegressionAvoidInlineConditionalsVariableDef']]"
+ "InputXpathAvoidInlineConditionalsVariableDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='substring']]/SLIST"
+ "/VARIABLE_DEF[./IDENT[@text='b']]/ASSIGN/EXPR",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='"
+ "SuppressionXpathRegressionAvoidInlineConditionalsVariableDef']]"
+ "InputXpathAvoidInlineConditionalsVariableDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='substring']]/SLIST"
+ "/VARIABLE_DEF[./IDENT[@text='b']]/ASSIGN/EXPR/QUESTION"
);
Expand All @@ -67,7 +67,7 @@ public void testInlineConditionalsVariableDef() throws Exception {
@Test
public void testInlineConditionalsAssign() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidInlineConditionalsAssign.java"));
getPath("InputXpathAvoidInlineConditionalsAssign.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidInlineConditionalsCheck.class);
Expand All @@ -79,7 +79,7 @@ public void testInlineConditionalsAssign() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='"
+ "SuppressionXpathRegressionAvoidInlineConditionalsAssign']]"
+ "InputXpathAvoidInlineConditionalsAssign']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='setB']]/SLIST"
+ "/EXPR/ASSIGN[./IDENT[@text='b']]/QUESTION"
);
Expand All @@ -91,7 +91,7 @@ public void testInlineConditionalsAssign() throws Exception {
@Test
public void testInlineConditionalsAssert() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidInlineConditionalsAssert.java"));
getPath("InputXpathAvoidInlineConditionalsAssert.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidInlineConditionalsCheck.class);
Expand All @@ -103,11 +103,11 @@ public void testInlineConditionalsAssert() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='"
+ "SuppressionXpathRegressionAvoidInlineConditionalsAssert']]"
+ "InputXpathAvoidInlineConditionalsAssert']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='assertA']]/SLIST"
+ "/LITERAL_ASSERT/EXPR[./QUESTION/METHOD_CALL/DOT/IDENT[@text='a']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='"
+ "SuppressionXpathRegressionAvoidInlineConditionalsAssert']]"
+ "InputXpathAvoidInlineConditionalsAssert']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='assertA']]/SLIST"
+ "/LITERAL_ASSERT/EXPR/QUESTION"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected String getCheckName() {
@Test
public void testEmpty() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidNestedBlocksEmpty.java"));
getPath("InputXpathAvoidNestedBlocksEmpty.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidNestedBlocksCheck.class);
Expand All @@ -51,7 +51,7 @@ public void testEmpty() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionAvoidNestedBlocksEmpty']]"
+ "[./IDENT[@text='InputXpathAvoidNestedBlocksEmpty']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='empty']]/SLIST/SLIST"
);

Expand All @@ -62,7 +62,7 @@ public void testEmpty() throws Exception {
@Test
public void testVariableAssignment() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidNestedBlocksVariable.java"));
getPath("InputXpathAvoidNestedBlocksVariable.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidNestedBlocksCheck.class);
Expand All @@ -74,7 +74,7 @@ public void testVariableAssignment() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionAvoidNestedBlocksVariable']]"
+ "[./IDENT[@text='InputXpathAvoidNestedBlocksVariable']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='varAssign']]/SLIST/SLIST"
);

Expand All @@ -85,7 +85,7 @@ public void testVariableAssignment() throws Exception {
@Test
public void testSwitchAllowInSwitchCaseFalse() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionAvoidNestedBlocksNotAllowedInSwitchCase.java"));
"InputXpathAvoidNestedBlocksNotAllowedInSwitchCase.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidNestedBlocksCheck.class);
Expand All @@ -97,12 +97,12 @@ public void testSwitchAllowInSwitchCaseFalse() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionAvoidNested"
+ "BlocksNotAllowedInSwitchCase']]/OBJBLOCK/METHOD_DEF"
+ "[./IDENT[@text='InputXpathAvoidNestedBlocksNotAllowedInSwitchCase"
+ "']]/OBJBLOCK/METHOD_DEF"
+ "[./IDENT[@text='s']]/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionAvoidNested"
+ "BlocksNotAllowedInSwitchCase']]/OBJBLOCK/METHOD_DEF"
+ "[./IDENT[@text='InputXpathAvoidNestedBlocksNotAllowedInSwitchCase"
+ "']]/OBJBLOCK/METHOD_DEF"
+ "[./IDENT[@text='s']]/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST/SLIST"
);

Expand All @@ -113,7 +113,7 @@ public void testSwitchAllowInSwitchCaseFalse() throws Exception {
@Test
public void testSwitchAllowInSwitchCaseTrue() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidNestedBlocksAllowedInSwitchCase.java"));
getPath("InputXpathAvoidNestedBlocksAllowedInSwitchCase.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidNestedBlocksCheck.class);
Expand All @@ -126,7 +126,7 @@ public void testSwitchAllowInSwitchCaseTrue() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionAvoidNestedBlocksAllowedInSwitchCase"
+ "[@text='InputXpathAvoidNestedBlocksAllowedInSwitchCase"
+ "']]/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]"
+ "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST/SLIST"
);
Expand All @@ -138,7 +138,7 @@ public void testSwitchAllowInSwitchCaseTrue() throws Exception {
@Test
public void testSwitchWithBreakOutside() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionAvoidNestedBlocksBreakOutside.java"));
getPath("InputXpathAvoidNestedBlocksBreakOutside.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(AvoidNestedBlocksCheck.class);
Expand All @@ -150,11 +150,11 @@ public void testSwitchWithBreakOutside() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionAvoidNestedBlocksBreakOutside']]"
+ "[@text='InputXpathAvoidNestedBlocksBreakOutside']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]"
+ "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionAvoidNestedBlocksBreakOutside']]"
+ "[@text='InputXpathAvoidNestedBlocksBreakOutside']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]"
+ "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST/SLIST"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.*;

public class SuppressionXpathRegressionAvoidDoubleBraceInitialization {
public class InputXpathAvoidDoubleBraceInitializationClassFields {
List list = new ArrayList<Object>() { //warn
{}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.HashSet;

public class SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo {
public class InputXpathAvoidDoubleBraceInitializationMethodDef {
public void test() {
new HashSet<String>() {{ /** warn */
add("foo");
Expand Down
Loading

0 comments on commit 341cb5e

Please sign in to comment.