Skip to content

Commit

Permalink
Issue checkstyle#14625: Enforced new naming convention in IT area 23
Browse files Browse the repository at this point in the history
  • Loading branch information
MANISH-K-07 committed Apr 24, 2024
1 parent d6d4a5d commit e02daf9
Show file tree
Hide file tree
Showing 44 changed files with 156 additions and 166 deletions.
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testOne() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRequireThisOne.java"));
new File(getPath("InputXpathRequireThisOne.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(RequireThisCheck.class);
Expand All @@ -53,7 +53,7 @@ public void testOne() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionRequireThisOne']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathRequireThisOne']]/OBJBLOCK"
+ "/METHOD_DEF[./IDENT[@text='changeAge']]/SLIST/EXPR/ASSIGN"
+ "/IDENT[@text='age']"
);
Expand All @@ -65,7 +65,7 @@ public void testOne() throws Exception {
@Test
public void testTwo() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRequireThisTwo.java"));
new File(getPath("InputXpathRequireThisTwo.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionRequireThisTwo']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathRequireThisTwo']]/OBJBLOCK"
+ "/METHOD_DEF[./IDENT[@text='method2']]/SLIST/EXPR"
+ "/METHOD_CALL/IDENT[@text='method1']"
);
Expand Down
Expand Up @@ -36,9 +36,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testVoid() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionReturnCount1.java")
getPath("InputXpathReturnCountVoid.java")
);

final DefaultConfiguration moduleConfig =
Expand All @@ -51,26 +51,26 @@ public void testOne() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]"
+ "[./IDENT[@text='InputXpathReturnCountVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]"
+ "[./IDENT[@text='InputXpathReturnCountVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]"
+ "[./IDENT[@text='InputXpathReturnCountVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/TYPE",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]"
+ "[./IDENT[@text='InputXpathReturnCountVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/TYPE/LITERAL_VOID"
);

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

@Test
public void testTwo() throws Exception {
public void testCustomMaxForVoid() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionReturnCount1.java")
getPath("InputXpathReturnCountVoid.java")
);

final DefaultConfiguration moduleConfig =
Expand All @@ -85,26 +85,26 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]"
+ "[./IDENT[@text='InputXpathReturnCountVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]"
+ "[./IDENT[@text='InputXpathReturnCountVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]"
+ "[./IDENT[@text='InputXpathReturnCountVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/TYPE",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]"
+ "[./IDENT[@text='InputXpathReturnCountVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/TYPE/LITERAL_VOID"
);

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

@Test
public void testThree() throws Exception {
public void testNonVoid() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionReturnCount2.java")
getPath("InputXpathReturnCountNonVoid.java")
);

final DefaultConfiguration moduleConfig =
Expand All @@ -117,26 +117,26 @@ public void testThree() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]"
+ "[./IDENT[@text='InputXpathReturnCountNonVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]"
+ "[./IDENT[@text='InputXpathReturnCountNonVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]"
+ "[./IDENT[@text='InputXpathReturnCountNonVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/TYPE",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]"
+ "[./IDENT[@text='InputXpathReturnCountNonVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/TYPE/LITERAL_BOOLEAN"
);

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

@Test
public void testFour() throws Exception {
public void testCustomMax() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionReturnCount2.java")
getPath("InputXpathReturnCountNonVoid.java")
);

final DefaultConfiguration moduleConfig =
Expand All @@ -151,26 +151,26 @@ public void testFour() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]"
+ "[./IDENT[@text='InputXpathReturnCountNonVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]"
+ "[./IDENT[@text='InputXpathReturnCountNonVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]"
+ "[./IDENT[@text='InputXpathReturnCountNonVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/TYPE",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]"
+ "[./IDENT[@text='InputXpathReturnCountNonVoid']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/TYPE/LITERAL_BOOLEAN"
);

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

@Test
public void testFive() throws Exception {
public void testCtor() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionReturnCount3.java")
getPath("InputXpathReturnCountCtor.java")
);

final DefaultConfiguration moduleConfig =
Expand All @@ -183,24 +183,24 @@ public void testFive() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]",
+ "[./IDENT[@text='InputXpathReturnCountCtor']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InputXpathReturnCountCtor']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]"
+ "[./IDENT[@text='InputXpathReturnCountCtor']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InputXpathReturnCountCtor']]"
+ "/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]"
+ "/OBJBLOCK/CTOR_DEF/IDENT[@text='SuppressionXpathRegressionReturnCount3']"
+ "[./IDENT[@text='InputXpathReturnCountCtor']]"
+ "/OBJBLOCK/CTOR_DEF/IDENT[@text='InputXpathReturnCountCtor']"
);

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

@Test
public void testSix() throws Exception {
public void testLambda() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionReturnCount4.java")
getPath("InputXpathReturnCountLambda.java")
);

final DefaultConfiguration moduleConfig =
Expand All @@ -213,7 +213,7 @@ public void testSix() throws Exception {

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionReturnCount4']]"
+ "[./IDENT[@text='InputXpathReturnCountLambda']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testLambda']]/SLIST"
+ "/VARIABLE_DEF[./IDENT[@text='a']]/ASSIGN/LAMBDA[./IDENT[@text='i']]"
);
Expand Down
Expand Up @@ -41,7 +41,7 @@ protected String getCheckName() {
@Test
public void testOne() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRightCurlyOne.java"));
new File(getPath("InputXpathRightCurlyOne.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(RightCurlyCheck.class);
Expand All @@ -53,7 +53,7 @@ public void testOne() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionRightCurlyOne']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathRightCurlyOne']]/OBJBLOCK"
+ "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF/SLIST/RCURLY"
);

Expand All @@ -64,7 +64,7 @@ public void testOne() throws Exception {
@Test
public void testTwo() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRightCurlyTwo.java"));
new File(getPath("InputXpathRightCurlyTwo.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(RightCurlyCheck.class);
Expand All @@ -77,7 +77,7 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionRightCurlyTwo']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathRightCurlyTwo']]/OBJBLOCK"
+ "/METHOD_DEF[./IDENT[@text='fooMethod']]/SLIST/LITERAL_TRY/SLIST/RCURLY"
);

Expand All @@ -88,7 +88,7 @@ public void testTwo() throws Exception {
@Test
public void testThree() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRightCurlyThree.java"));
new File(getPath("InputXpathRightCurlyThree.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionRightCurlyThree']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathRightCurlyThree']]/OBJBLOCK"
+ "/METHOD_DEF[./IDENT[@text='sample']]/SLIST/LITERAL_IF/SLIST/RCURLY"
);

Expand All @@ -112,7 +112,7 @@ public void testThree() throws Exception {
@Test
public void testFour() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRightCurlyFour.java"));
new File(getPath("InputXpathRightCurlyFour.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionRightCurlyFour']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathRightCurlyFour']]/OBJBLOCK"
+ "/METHOD_DEF[./IDENT[@text='sample']]/SLIST/LITERAL_IF/SLIST/RCURLY"
);

Expand Down
Expand Up @@ -38,9 +38,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testDefault() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionThrowsCount1.java"));
new File(getPath("InputXpathThrowsCountDefault.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(ThrowsCountCheck.class);
final String[] expectedViolation = {
Expand All @@ -49,7 +49,7 @@ public void testOne() throws Exception {
};
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionThrowsCount1']]"
+ "/CLASS_DEF[./IDENT[@text='InputXpathThrowsCountDefault']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]"
+ "/LITERAL_THROWS[./IDENT[@text='CloneNotSupportedException']]"

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

@Test
public void testTwo() throws Exception {
public void testCustomMax() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionThrowsCount2.java"));
new File(getPath("InputXpathThrowsCountCustomMax.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(ThrowsCountCheck.class);

Expand All @@ -74,7 +74,7 @@ public void testTwo() throws Exception {
};
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT"
+ "/INTERFACE_DEF[./IDENT[@text='SuppressionXpathRegressionThrowsCount2']]"
+ "/INTERFACE_DEF[./IDENT[@text='InputXpathThrowsCountCustomMax']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]"
+ "/LITERAL_THROWS[./IDENT[@text='IllegalStateException']]"

Expand All @@ -85,9 +85,9 @@ public void testTwo() throws Exception {
}

@Test
public void testThree() throws Exception {
public void testPrivateMethods() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionThrowsCount3.java"));
new File(getPath("InputXpathThrowsCountPrivateMethods.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(ThrowsCountCheck.class);

Expand All @@ -99,7 +99,7 @@ public void testThree() throws Exception {
};
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionThrowsCount3']]"
+ "/CLASS_DEF[./IDENT[@text='InputXpathThrowsCountPrivateMethods']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunc']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='foo']]"
+ "/ASSIGN/EXPR/LITERAL_NEW[./IDENT[@text='myClass']]"
Expand Down
Expand Up @@ -39,9 +39,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testSingleLine() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionTodoCommentOne.java"));
new File(getPath("InputXpathTodoCommentSingleLine.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(TodoCommentCheck.class);
Expand All @@ -53,17 +53,17 @@ public void testOne() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionTodoCommentOne']]/OBJBLOCK/"
+ "'InputXpathTodoCommentSingleLine']]/OBJBLOCK/"
+ "SINGLE_LINE_COMMENT/COMMENT_CONTENT[@text=' warn FIXME:\\n']");

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

@Test
public void testTwo() throws Exception {
public void testBlock() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionTodoCommentTwo.java"));
new File(getPath("InputXpathTodoCommentBlock.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionTodoCommentTwo']]/"
+ "'InputXpathTodoCommentBlock']]/"
+ "OBJBLOCK/BLOCK_COMMENT_BEGIN/COMMENT_CONTENT"
+ "[@text=' // warn\\n * FIXME:\\n * TODO\\n ']"
);
Expand Down

0 comments on commit e02daf9

Please sign in to comment.