Skip to content

Commit

Permalink
Issue #14715: Enforced new naming convention in IT area 21
Browse files Browse the repository at this point in the history
  • Loading branch information
MANISH-K-07 authored and rnveach committed Apr 21, 2024
1 parent bbabd4e commit bb05c90
Show file tree
Hide file tree
Showing 25 changed files with 128 additions and 134 deletions.
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 testMissingJavadocMethodCtor() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionMissingJavadocMethod1.java")
getPath("InputXpathMissingJavadocMethodCtor.java")
);

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

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

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

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod1']]"
+ "[./IDENT[@text='InputXpathMissingJavadocMethodCtor']]"
+ "/OBJBLOCK/CTOR_DEF[."
+ "/IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod1']]"
+ "/IDENT[@text='InputXpathMissingJavadocMethodCtor']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);

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

@Test
public void testTwo() throws Exception {
public void testMissingJavadocMethod() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionMissingJavadocMethod2.java")
getPath("InputXpathMissingJavadocMethod.java")
);

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

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

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod2']]"
+ "[./IDENT[@text='InputXpathMissingJavadocMethod']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]"
+ "/MODIFIERS",

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod2']]"
+ "[./IDENT[@text='InputXpathMissingJavadocMethod']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testClass() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionMissingJavadocTypeClass.java"
"InputXpathMissingJavadocTypeClass.java"
));

final DefaultConfiguration moduleConfig =
Expand All @@ -54,12 +54,12 @@ public void testClass() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeClass']]",
+ "[./IDENT[@text='InputXpathMissingJavadocTypeClass']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeClass']]"
+ "[./IDENT[@text='InputXpathMissingJavadocTypeClass']]"
+ "/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeClass']]"
+ "[./IDENT[@text='InputXpathMissingJavadocTypeClass']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);

Expand All @@ -69,7 +69,7 @@ public void testClass() throws Exception {
@Test
public void testScope() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionMissingJavadocTypeScope.java"
"InputXpathMissingJavadocTypeScope.java"
));

final DefaultConfiguration moduleConfig =
Expand All @@ -84,13 +84,13 @@ public void testScope() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeScope']]"
+ "[./IDENT[@text='InputXpathMissingJavadocTypeScope']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeScope']]"
+ "[./IDENT[@text='InputXpathMissingJavadocTypeScope']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeScope']]"
+ "[./IDENT[@text='InputXpathMissingJavadocTypeScope']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS/LITERAL_PRIVATE"
);

Expand All @@ -100,7 +100,7 @@ public void testScope() throws Exception {
@Test
public void testExcluded() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionMissingJavadocTypeExcluded.java"
"InputXpathMissingJavadocTypeExcluded.java"
));

final DefaultConfiguration moduleConfig =
Expand All @@ -116,13 +116,13 @@ public void testExcluded() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeExcluded']]"
+ "[./IDENT[@text='InputXpathMissingJavadocTypeExcluded']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeExcluded']]"
+ "[./IDENT[@text='InputXpathMissingJavadocTypeExcluded']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeExcluded']]"
+ "[./IDENT[@text='InputXpathMissingJavadocTypeExcluded']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS/LITERAL_PRIVATE"
);

Expand All @@ -132,7 +132,7 @@ public void testExcluded() throws Exception {
@Test
public void testAnnotation() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionMissingJavadocTypeAnnotation.java"
"InputXpathMissingJavadocTypeAnnotation.java"
));

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionMissingJavadocTypeAnnotation']]"
+ "'InputXpathMissingJavadocTypeAnnotation']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionMissingJavadocTypeAnnotation']]"
+ "'InputXpathMissingJavadocTypeAnnotation']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionMissingJavadocTypeAnnotation']]"
+ "'InputXpathMissingJavadocTypeAnnotation']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]"
+ "/MODIFIERS/ANNOTATION[./IDENT[@text='TestAnnotation2']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionMissingJavadocTypeAnnotation']]"
+ "'InputXpathMissingJavadocTypeAnnotation']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]"
+ "/MODIFIERS/ANNOTATION[./IDENT[@text='TestAnnotation2']]/AT"
);
Expand All @@ -168,7 +168,7 @@ public void testAnnotation() throws Exception {
@Test
public void testToken() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionMissingJavadocTypeToken.java"
"InputXpathMissingJavadocTypeToken.java"
));

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionMissingJavadocTypeToken']]",
+ "'InputXpathMissingJavadocTypeToken']]",
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionMissingJavadocTypeToken']]"
+ "'InputXpathMissingJavadocTypeToken']]"
+ "/MODIFIERS",
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionMissingJavadocTypeToken']]"
+ "'InputXpathMissingJavadocTypeToken']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);

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

@Test
public void testOne() throws Exception {
public void testMethod() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionNPathComplexityOne.java"));
new File(getPath("InputXpathNPathComplexityMethod.java"));

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

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

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

@Test
public void testTwo() throws Exception {
public void testStaticBlock() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionNPathComplexityTwo.java"));
new File(getPath("InputXpathNPathComplexityStaticBlock.java"));

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

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

Expand Down
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 testDefault() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionOverloadMethodsDeclarationOrder1.java"));
getPath("InputXpathOverloadMethodsDeclarationOrderDefault.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(clazz);

Expand All @@ -52,13 +52,13 @@ public void testOne() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]"
+ "[@text='InputXpathOverloadMethodsDeclarationOrderDefault']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]"
+ "[@text='InputXpathOverloadMethodsDeclarationOrderDefault']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]"
+ "[@text='InputXpathOverloadMethodsDeclarationOrderDefault']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);
Expand All @@ -67,9 +67,9 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testAnonymous() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionOverloadMethodsDeclarationOrder2.java"));
getPath("InputXpathOverloadMethodsDeclarationOrderAnonymous.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(clazz);

Expand All @@ -80,19 +80,19 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]"
+ "'InputXpathOverloadMethodsDeclarationOrderAnonymous']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text="
+ "'MySuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]"
+ "'MyInputXpathOverloadMethodsDeclarationOrderAnonymous']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]"
+ "'InputXpathOverloadMethodsDeclarationOrderAnonymous']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text="
+ "'MySuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]"
+ "'MyInputXpathOverloadMethodsDeclarationOrderAnonymous']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]"
+ "'InputXpathOverloadMethodsDeclarationOrderAnonymous']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text="
+ "'MySuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]"
+ "'MyInputXpathOverloadMethodsDeclarationOrderAnonymous']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testInternal() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRedundantImport1.java"));
new File(getPath("InputXpathRedundantImportInternal.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(RedundantImportCheck.class);
final String[] expectedViolation = {
"3:1: " + getCheckMessage(RedundantImportCheck.class,
RedundantImportCheck.MSG_SAME, "org.checkstyle.suppressionxpathfilter"
+ ".redundantimport.SuppressionXpathRegressionRedundantImport1"),
+ ".redundantimport.InputXpathRedundantImportInternal"),
};
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/IMPORT");
Expand All @@ -56,9 +56,9 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testLibrary() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRedundantImport2.java"));
new File(getPath("InputXpathRedundantImportLibrary.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(RedundantImportCheck.class);
final String[] expectedViolation = {
Expand All @@ -73,9 +73,9 @@ public void testTwo() throws Exception {
}

@Test
public void testThree() throws Exception {
public void testDuplicate() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionRedundantImport3.java"));
new File(getPath("InputXpathRedundantImportDuplicate.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(RedundantImportCheck.class);
final String[] expectedViolation = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.missingjavadocmethod;

public class SuppressionXpathRegressionMissingJavadocMethod2 {
public class InputXpathMissingJavadocMethod {
public void foo() { // warn
// code
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.checkstyle.suppressionxpathfilter.missingjavadocmethod;

public class InputXpathMissingJavadocMethodCtor {
public InputXpathMissingJavadocMethodCtor() { // warn
// code
}
}

This file was deleted.

0 comments on commit bb05c90

Please sign in to comment.