Skip to content

Commit

Permalink
Issue #14715: Enforced new naming convention in IT area 13
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 f085e53 commit 9c26348
Show file tree
Hide file tree
Showing 24 changed files with 72 additions and 78 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(
"SuppressionXpathRegressionNoEnumTrailingCommaOne.java"));
"InputXpathNoEnumTrailingCommaOne.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoEnumTrailingCommaOne']]"
+ "[./IDENT[@text='InputXpathNoEnumTrailingCommaOne']]"
+ "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Foo3']]/OBJBLOCK/COMMA[2]"
);

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

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoEnumTrailingCommaTwo']]"
+ "[./IDENT[@text='InputXpathNoEnumTrailingCommaTwo']]"
+ "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Foo6']]/OBJBLOCK/COMMA[2]"
);

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

@Test
public void testOne() throws Exception {
public void testMain() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionNoFinalizer1.java"));
getPath("InputXpathNoFinalizerMain.java"));

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer1']]"
+ "[./IDENT[@text='InputXpathNoFinalizerMain']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='finalize']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer1']]"
+ "[./IDENT[@text='InputXpathNoFinalizerMain']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer1']]"
+ "[./IDENT[@text='InputXpathNoFinalizerMain']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS/LITERAL_PROTECTED"
);

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

@Test
public void testTwo() throws Exception {
public void testInner() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionNoFinalizer2.java"));
getPath("InputXpathNoFinalizerInner.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(NoFinalizerCheck.class);
Expand All @@ -79,20 +79,20 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer2']]"
+ "[./IDENT[@text='InputXpathNoFinalizerInner']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='finalize']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer2']]"
+ "[./IDENT[@text='InputXpathNoFinalizerInner']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer2']]"
+ "[./IDENT[@text='InputXpathNoFinalizerInner']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS/"
+ "ANNOTATION[./IDENT[@text='Override']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer2']]"
+ "[./IDENT[@text='InputXpathNoFinalizerInner']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS/"
+ "ANNOTATION[./IDENT[@text='Override']]/AT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testDefault() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionNoLineWrap1.java")
getPath("InputXpathNoLineWrapDefault.java")
);

final DefaultConfiguration moduleConfig =
Expand All @@ -57,9 +57,9 @@ public void testOne() throws Exception {
}

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

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionNoLineWrap2']]"
+ "[@text='InputXpathNoLineWrapTokensMethodDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test2']]",

"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionNoLineWrap2']]"
+ "[@text='InputXpathNoLineWrapTokensMethodDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test2']]"
+ "/MODIFIERS",

"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionNoLineWrap2']]"
+ "[@text='InputXpathNoLineWrapTokensMethodDef']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test2']]"
+ "/MODIFIERS/LITERAL_PUBLIC"

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

@Test
public void testThree() throws Exception {
public void testTokensCtorDef() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionNoLineWrap3.java")
getPath("InputXpathNoLineWrapTokensCtorDef.java")
);

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]",
+ "[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]",

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]"
+ "[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]"
+ "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]"
+ "/MODIFIERS",

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]"
+ "/OBJBLOCK/CTOR_DEF/IDENT[@text='SuppressionXpathRegressionNoLineWrap3']"
+ "[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]"
+ "/OBJBLOCK/CTOR_DEF/IDENT[@text='InputXpathNoLineWrapTokensCtorDef']"
);

runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected String getCheckName() {
@Test
public void testNoWhitespaceAfter() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionNoWhitespaceAfter.java"));
new File(getPath("InputXpathNoWhitespaceAfter.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(NoWhitespaceAfterCheck.class);
Expand All @@ -53,10 +53,10 @@ public void testNoWhitespaceAfter() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfter']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathNoWhitespaceAfter']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfter']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathNoWhitespaceAfter']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/UNARY_MINUS["
+ "./NUM_INT[@text='1']]"
);
Expand All @@ -68,7 +68,7 @@ public void testNoWhitespaceAfter() throws Exception {
@Test
public void testTokens() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionNoWhitespaceAfterTokens.java"));
new File(getPath("InputXpathNoWhitespaceAfterTokens.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(NoWhitespaceAfterCheck.class);
Expand All @@ -81,7 +81,7 @@ public void testTokens() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterTokens']]"
+ "[./IDENT[@text='InputXpathNoWhitespaceAfterTokens']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/TYPE/DOT[./IDENT[@text='String']]"
+ "/DOT[./IDENT[@text='java']]"
Expand All @@ -94,7 +94,7 @@ public void testTokens() throws Exception {
@Test
public void testAllowLineBreaks() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionNoWhitespaceAfterLineBreaks.java"));
new File(getPath("InputXpathNoWhitespaceAfterLineBreaks.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(NoWhitespaceAfterCheck.class);
Expand All @@ -107,20 +107,20 @@ public void testAllowLineBreaks() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterLineBreaks']]"
+ "[./IDENT[@text='InputXpathNoWhitespaceAfterLineBreaks']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='s']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterLineBreaks']]"
+ "[./IDENT[@text='InputXpathNoWhitespaceAfterLineBreaks']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='s']]"
+ "/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterLineBreaks']]"
+ "[./IDENT[@text='InputXpathNoWhitespaceAfterLineBreaks']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='s']]/TYPE",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterLineBreaks']]"
+ "[./IDENT[@text='InputXpathNoWhitespaceAfterLineBreaks']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='s']]"
+ "/TYPE/DOT[./IDENT[@text='String']]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected String getCheckName() {
public void testOne() throws Exception {
final File fileToProcess =
new File(getPath(
"SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonOne.java"));
"InputXpathNoWhitespaceBeforeCaseDefaultColonOne.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonOne']]"
+ "'InputXpathNoWhitespaceBeforeCaseDefaultColonOne']]"
+ "/OBJBLOCK/INSTANCE_INIT/SLIST/LITERAL_SWITCH/CASE_GROUP/LITERAL_CASE/COLON"
);

Expand All @@ -66,7 +66,7 @@ public void testOne() throws Exception {
public void testTwo() throws Exception {
final File fileToProcess =
new File(getPath(
"SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonTwo.java"));
"InputXpathNoWhitespaceBeforeCaseDefaultColonTwo.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonTwo']]"
+ "'InputXpathNoWhitespaceBeforeCaseDefaultColonTwo']]"
+ "/OBJBLOCK/INSTANCE_INIT/SLIST/LITERAL_SWITCH/CASE_GROUP"
+ "/LITERAL_DEFAULT/COLON"
);
Expand All @@ -91,7 +91,7 @@ public void testTwo() throws Exception {
public void testThree() throws Exception {
final File fileToProcess =
new File(getPath(
"SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonThree.java"));
"InputXpathNoWhitespaceBeforeCaseDefaultColonThree.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonThree']]"
+ "'InputXpathNoWhitespaceBeforeCaseDefaultColonThree']]"
+ "/OBJBLOCK/INSTANCE_INIT/SLIST/LITERAL_SWITCH/CASE_GROUP"
+ "/LITERAL_CASE/COLON"
);
Expand All @@ -116,7 +116,7 @@ public void testThree() throws Exception {
public void testFour() throws Exception {
final File fileToProcess =
new File(getPath(
"SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonFour.java"));
"InputXpathNoWhitespaceBeforeCaseDefaultColonFour.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonFour']]"
+ "'InputXpathNoWhitespaceBeforeCaseDefaultColonFour']]"
+ "/OBJBLOCK/INSTANCE_INIT/SLIST/LITERAL_SWITCH/CASE_GROUP"
+ "/LITERAL_DEFAULT/COLON"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testNoWhitespaceBefore() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionNoWhitespaceBefore.java"));
new File(getPath("InputXpathNoWhitespaceBefore.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceBefore']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathNoWhitespaceBefore']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='bad']]/SEMI"
);

Expand All @@ -63,7 +63,7 @@ public void testNoWhitespaceBefore() throws Exception {
@Test
public void testTokens() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionNoWhitespaceBeforeTokens.java"));
new File(getPath("InputXpathNoWhitespaceBeforeTokens.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(NoWhitespaceBeforeCheck.class);
Expand All @@ -76,7 +76,7 @@ public void testTokens() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceBeforeTokens']]"
+ "[./IDENT[@text='InputXpathNoWhitespaceBeforeTokens']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/TYPE/DOT[./IDENT[@text='String']]"
+ "/DOT[./IDENT[@text='java']]"
Expand All @@ -89,7 +89,7 @@ public void testTokens() throws Exception {
@Test
public void testAllowLineBreaks() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionNoWhitespaceBeforeLineBreaks.java"));
new File(getPath("InputXpathNoWhitespaceBeforeLineBreaks.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(NoWhitespaceBeforeCheck.class);
Expand All @@ -102,7 +102,7 @@ public void testAllowLineBreaks() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceBeforeLineBreaks']]"
+ "[./IDENT[@text='InputXpathNoWhitespaceBeforeLineBreaks']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='array']]"
+ "/ASSIGN/ARRAY_INIT/COMMA"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.noenumtrailingcomma;

public class SuppressionXpathRegressionNoEnumTrailingCommaOne {
public class InputXpathNoEnumTrailingCommaOne {

enum Foo3 {
FOO,
Expand Down
Loading

0 comments on commit 9c26348

Please sign in to comment.