Skip to content

Commit

Permalink
Issue #14715: Enforced new naming convention in IT area Five
Browse files Browse the repository at this point in the history
  • Loading branch information
MANISH-K-07 authored and romani committed Apr 1, 2024
1 parent 341cb5e commit aef4a32
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 71 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("SuppressionXpathRegressionJavaNCSSOne.java"));
new File(getPath("InputXpathJavaNCSSOne.java"));

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

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavaNCSSOne']]"
+ "[./IDENT[@text='InputXpathJavaNCSSOne']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]",

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavaNCSSOne']]"
+ "[./IDENT[@text='InputXpathJavaNCSSOne']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS",

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavaNCSSOne']]"
+ "[./IDENT[@text='InputXpathJavaNCSSOne']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS/LITERAL_PUBLIC"
);

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

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

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavaNCSSTwo']]",
+ "[./IDENT[@text='InputXpathJavaNCSSTwo']]",

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavaNCSSTwo']]/MODIFIERS",
+ "[./IDENT[@text='InputXpathJavaNCSSTwo']]/MODIFIERS",

"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavaNCSSTwo']]"
+ "[./IDENT[@text='InputXpathJavaNCSSTwo']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);

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

final DefaultConfiguration moduleConfig =
createModuleConfig(JavaNCSSCheck.class);
Expand Down
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("SuppressionXpathRegressionJavadocContentLocationOne.java"));
new File(getPath("InputXpathJavadocContentLocationOne.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/INTERFACE_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocContentLocationOne']]"
+ "[./IDENT[@text='InputXpathJavadocContentLocationOne']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE/BLOCK_COMMENT_BEGIN"
+ "[./COMMENT_CONTENT[@text='* Text. // warn\\n ']]"
);
Expand All @@ -64,7 +64,7 @@ public void testOne() throws Exception {
@Test
public void testTwo() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionJavadocContentLocationTwo.java"));
new File(getPath("InputXpathJavadocContentLocationTwo.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionJavadocContentLocationTwo']]"
+ "[@text='InputXpathJavadocContentLocationTwo']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE/BLOCK_COMMENT_BEGIN"
+ "[./COMMENT_CONTENT[@text='*\\n * Text.\\n ']]"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected String getCheckName() {
@Test
public void testOne() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionJavadocMethodOne.java"));
new File(getPath("InputXpathJavadocMethodOne.java"));

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

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

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

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodTwo']]"
+ "[./IDENT[@text='InputXpathJavadocMethodTwo']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkParam']]/PARAMETERS"
+ "/PARAMETER_DEF/IDENT[@text='x']");

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

final DefaultConfiguration moduleConfig =
createModuleConfig(JavadocMethodCheck.class);
Expand All @@ -107,11 +107,11 @@ public void testThree() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodThree']]"
+ "[./IDENT[@text='InputXpathJavadocMethodThree']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkTypeParam']]/TYPE_PARAMETERS"
+ "/TYPE_PARAMETER[./IDENT[@text='T']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodThree']]"
+ "[./IDENT[@text='InputXpathJavadocMethodThree']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkTypeParam']]/TYPE_PARAMETERS"
+ "/TYPE_PARAMETER/IDENT[@text='T']");

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

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodFour']]"
+ "[./IDENT[@text='InputXpathJavadocMethodFour']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]"
+ "/LITERAL_THROWS/IDENT[@text='Exception']");

Expand All @@ -147,7 +147,7 @@ public void testFour() throws Exception {
@Test
public void testFive() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionJavadocMethodFive.java"));
new File(getPath("InputXpathJavadocMethodFive.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(JavadocMethodCheck.class);
Expand All @@ -161,7 +161,7 @@ public void testFive() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodFive']]"
+ "[./IDENT[@text='InputXpathJavadocMethodFive']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bar']]/SLIST"
+ "/LITERAL_THROW/EXPR/LITERAL_NEW"
+ "/DOT[./IDENT[@text='BuildException']]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testMissingTag() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionJavadocTypeOne.java"));
new File(getPath("InputXpathJavadocTypeMissingTag.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(JavadocTypeCheck.class);
Expand All @@ -58,22 +58,22 @@ public void testOne() throws Exception {

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

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

@Test
public void testTwo() throws Exception {
public void testWrongFormat() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionJavadocTypeTwo.java"));
new File(getPath("InputXpathJavadocTypeWrongFormat.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(JavadocTypeCheck.class);
Expand All @@ -87,21 +87,21 @@ public void testTwo() throws Exception {

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

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

@Test
public void testThree() throws Exception {
public void testIncomplete() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionJavadocTypeThree.java"));
new File(getPath("InputXpathJavadocTypeIncomplete.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(JavadocTypeCheck.class);
Expand All @@ -113,12 +113,12 @@ public void testThree() throws Exception {

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

runVerifications(moduleConfig, fileToProcess, expectedViolation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testPrivateClassFields() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionJavadocVariableOne.java"));
new File(getPath("InputXpathJavadocVariablePrivateClassFields.java"));

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

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

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

@Test
public void testTwo() throws Exception {
public void testInnerClassFields() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionJavadocVariableTwo.java"));
new File(getPath("InputXpathJavadocVariableInnerClassFields.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(JavadocVariableCheck.class);
Expand All @@ -81,15 +81,15 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableTwo']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathJavadocVariableInnerClassFields']]/OBJBLOCK"
+ "/CLASS_DEF[./IDENT[@text='InnerInner2']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='fData']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableTwo']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathJavadocVariableInnerClassFields']]/OBJBLOCK"
+ "/CLASS_DEF[./IDENT[@text='InnerInner2']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='fData']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableTwo']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathJavadocVariableInnerClassFields']]/OBJBLOCK"
+ "/CLASS_DEF[./IDENT[@text='InnerInner2']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='fData']]/MODIFIERS"
+ "/LITERAL_PUBLIC"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.javadoccontentlocation;

public interface SuppressionXpathRegressionJavadocContentLocationOne {
public interface InputXpathJavadocContentLocationOne {

/** Text. // warn
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.javadoccontentlocation;

public interface SuppressionXpathRegressionJavadocContentLocationTwo {
public interface InputXpathJavadocContentLocationTwo {

/* warn */ /**
* Text.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Config:
* validateThrows = true
*/
public class SuppressionXpathRegressionJavadocMethodFive {
public class InputXpathJavadocMethodFive {

/**
* Needs a throws tag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Config:
* validateThrows = true
*/
public class SuppressionXpathRegressionJavadocMethodFour {
public class InputXpathJavadocMethodFour {

/**
* Needs a throws tag.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Config:
*/
public class SuppressionXpathRegressionJavadocMethodOne {
public class InputXpathJavadocMethodOne {

/** {@inheritDoc} */
public void inheritableMethod() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Config:
*/
public class SuppressionXpathRegressionJavadocMethodThree {
public class InputXpathJavadocMethodThree {

/**
* Needs a param tag for T.
Expand Down
Loading

0 comments on commit aef4a32

Please sign in to comment.