Skip to content

Commit

Permalink
Issue checkstyle#14715: Enforced naming convention in IT area Ten
Browse files Browse the repository at this point in the history
  • Loading branch information
MANISH-K-07 authored and rnveach committed Apr 9, 2024
1 parent 375a353 commit 542db1d
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 87 deletions.
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 testInterface() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionClassMemberImpliedModifierOne.java"));
new File(getPath("InputXpathClassMemberImpliedModifierInterface.java"));

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionClassMemberImpliedModifierOne']]"
+ "@text='InputXpathClassMemberImpliedModifierInterface']]"
+ "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Foo']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionClassMemberImpliedModifierOne']]"
+ "@text='InputXpathClassMemberImpliedModifierInterface']]"
+ "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Foo']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionClassMemberImpliedModifierOne']]"
+ "@text='InputXpathClassMemberImpliedModifierInterface']]"
+ "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Foo']]/MODIFIERS/LITERAL_PUBLIC"
);

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

@Test
public void testTwo() throws Exception {
public void testEnum() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionClassMemberImpliedModifierTwo.java"));
new File(getPath("InputXpathClassMemberImpliedModifierEnum.java"));

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionClassMemberImpliedModifierTwo']]"
+ "[./IDENT[@text='InputXpathClassMemberImpliedModifierEnum']]"
+ "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Count']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionClassMemberImpliedModifierTwo']]"
+ "[./IDENT[@text='InputXpathClassMemberImpliedModifierEnum']]"
+ "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Count']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionClassMemberImpliedModifierTwo']]"
+ "[./IDENT[@text='InputXpathClassMemberImpliedModifierEnum']]"
+ "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Count']]/MODIFIERS/LITERAL_PUBLIC"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ protected String getCheckName() {
@Test
public void testSingleLine() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCommentsIndentation"
+ "SingleLine.java"));
new File(getPath("InputXpathCommentsIndentationSingleLine.java"));

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

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

Expand All @@ -64,8 +63,7 @@ public void testSingleLine() throws Exception {
@Test
public void testBlock() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCommentsIndentation"
+ "Block.java"));
new File(getPath("InputXpathCommentsIndentationBlock.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionCommentsIndentationBlock']]/OBJBLOCK/"
+ "[@text='InputXpathCommentsIndentationBlock']]/OBJBLOCK/"
+ "VARIABLE_DEF[./IDENT[@text='f']]/TYPE/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT"
+ "[@text=' // warn\\n * Javadoc comment\\n ']]"
);
Expand All @@ -89,8 +87,7 @@ public void testBlock() throws Exception {
@Test
public void testSeparator() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCommentsIndentation"
+ "Separator.java"));
new File(getPath("InputXpathCommentsIndentationSeparator.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionCommentsIndentationSeparator']]"
+ "[@text='InputXpathCommentsIndentationSeparator']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/MODIFIERS/SINGLE_LINE_COMMENT"
+ "[./COMMENT_CONTENT[@text='///////////// Comment separator // warn\\n']]"
);
Expand All @@ -114,8 +111,7 @@ public void testSeparator() throws Exception {
@Test
public void testDistributedStatement() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCommentsIndentation"
+ "DistributedStatement.java"));
new File(getPath("InputXpathCommentsIndentationDistributedStatement.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CommentsIndentationCheck.class);
Expand All @@ -127,7 +123,7 @@ public void testDistributedStatement() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionCommentsIndentationDistributedStatement']]"
+ "[@text='InputXpathCommentsIndentationDistributedStatement']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/SINGLE_LINE_COMMENT"
+ "[./COMMENT_CONTENT[@text=' Comment // warn\\n']]"
);
Expand All @@ -139,8 +135,7 @@ public void testDistributedStatement() throws Exception {
@Test
public void testSingleLineBlock() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCommentsIndentation"
+ "SingleLineBlock.java"));
new File(getPath("InputXpathCommentsIndentationSingleLineBlock.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CommentsIndentationCheck.class);
Expand All @@ -152,7 +147,7 @@ public void testSingleLineBlock() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionCommentsIndentationSingleLineBlock']]"
+ "[@text='InputXpathCommentsIndentationSingleLineBlock']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/SINGLE_LINE_COMMENT"
+ "[./COMMENT_CONTENT[@text=' block Comment // warn\\n']]"
);
Expand All @@ -164,8 +159,7 @@ public void testSingleLineBlock() throws Exception {
@Test
public void testNonEmptyCase() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCommentsIndentation"
+ "NonEmptyCase.java"));
new File(getPath("InputXpathCommentsIndentationNonEmptyCase.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CommentsIndentationCheck.class);
Expand All @@ -177,7 +171,7 @@ public void testNonEmptyCase() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionCommentsIndentationNonEmptyCase']]"
+ "[@text='InputXpathCommentsIndentationNonEmptyCase']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/LITERAL_SWITCH/"
+ "CASE_GROUP/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' Comment // warn\\n']]"
);
Expand All @@ -189,8 +183,7 @@ public void testNonEmptyCase() throws Exception {
@Test
public void testEmptyCase() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCommentsIndentation"
+ "EmptyCase.java"));
new File(getPath("InputXpathCommentsIndentationEmptyCase.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CommentsIndentationCheck.class);
Expand All @@ -202,7 +195,7 @@ public void testEmptyCase() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionCommentsIndentationEmptyCase']]"
+ "[@text='InputXpathCommentsIndentationEmptyCase']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/LITERAL_SWITCH/"
+ "CASE_GROUP/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' Comment // warn\\n']]"
);
Expand All @@ -214,8 +207,7 @@ public void testEmptyCase() throws Exception {
@Test
public void testWithinBlockStatement() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCommentsIndentation"
+ "WithinBlockStatement.java"));
new File(getPath("InputXpathCommentsIndentationWithinBlockStatement.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CommentsIndentationCheck.class);
Expand All @@ -227,7 +219,7 @@ public void testWithinBlockStatement() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionCommentsIndentationWithinBlockStatement']]"
+ "[@text='InputXpathCommentsIndentationWithinBlockStatement']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF"
+ "[./IDENT[@text='s']]/ASSIGN/EXPR/PLUS[./STRING_LITERAL[@text='O']]"
+ "/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' Comment // warn\\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 testLowercase() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionConstantNameLowercase.java"));
getPath("InputXpathConstantNameLowercase.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(CLASS);

Expand All @@ -54,7 +54,7 @@ public void testLowercase() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionConstantNameLowercase']]"
+ "[@text='InputXpathConstantNameLowercase']]"
+ "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='number']"
);

Expand All @@ -65,7 +65,7 @@ public void testLowercase() throws Exception {
@Test
public void testCamelCase() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionConstantNameCamelCase.java"));
new File(getPath("InputXpathConstantNameCamelCase.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(CLASS);

Expand All @@ -76,7 +76,7 @@ public void testCamelCase() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionConstantNameCamelCase']]"
+ "[./IDENT[@text='InputXpathConstantNameCamelCase']]"
+ "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='badConstant']"
);

Expand All @@ -87,7 +87,7 @@ public void testCamelCase() throws Exception {
@Test
public void testWithBeginningUnderscore() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionConstantNameWithBeginningUnderscore.java"));
getPath("InputXpathConstantNameWithBeginningUnderscore.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(CLASS);

Expand All @@ -97,7 +97,7 @@ public void testWithBeginningUnderscore() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionConstantNameWithBeginningUnderscore']]"
+ "[@text='InputXpathConstantNameWithBeginningUnderscore']]"
+ "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='_CONSTANT']"
);

Expand All @@ -108,7 +108,7 @@ public void testWithBeginningUnderscore() throws Exception {
@Test
public void testWithTwoUnderscores() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionConstantNameWithTwoUnderscores.java"));
getPath("InputXpathConstantNameWithTwoUnderscores.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(CLASS);

Expand All @@ -118,7 +118,7 @@ public void testWithTwoUnderscores() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionConstantNameWithTwoUnderscores']]"
+ "[@text='InputXpathConstantNameWithTwoUnderscores']]"
+ "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='BAD__NAME']"
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testCovariantEqualsInClass() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCovariantEqualsInClass.java"));
new File(getPath("InputXpathCovariantEqualsInClass.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCovariantEqualsInClass']]"
+ "[./IDENT[@text='InputXpathCovariantEqualsInClass']]"
+ "/OBJBLOCK/METHOD_DEF/IDENT[@text='equals']"
);

Expand All @@ -63,7 +63,7 @@ public void testCovariantEqualsInClass() throws Exception {
@Test
public void testCovariantEqualsInEnum() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionCovariantEqualsInEnum.java"));
new File(getPath("InputXpathCovariantEqualsInEnum.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/ENUM_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCovariantEqualsInEnum']]"
+ "[./IDENT[@text='InputXpathCovariantEqualsInEnum']]"
+ "/OBJBLOCK/METHOD_DEF/IDENT[@text='equals']");

runVerifications(moduleConfig, fileToProcess, expectedViolation,
Expand All @@ -86,7 +86,7 @@ public void testCovariantEqualsInEnum() throws Exception {
public void testCovariantEqualsInRecord() throws Exception {
final File fileToProcess =
new File(getNonCompilablePath(
"SuppressionXpathRegressionCovariantEqualsInRecord.java"));
"InputXpathCovariantEqualsInRecord.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(CovariantEqualsCheck.class);
Expand All @@ -98,7 +98,7 @@ public void testCovariantEqualsInRecord() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/RECORD_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionCovariantEqualsInRecord']]"
+ "[./IDENT[@text='InputXpathCovariantEqualsInRecord']]"
+ "/OBJBLOCK/METHOD_DEF/IDENT[@text='equals']");

runVerifications(moduleConfig, fileToProcess, expectedViolation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package org.checkstyle.suppressionxpathfilter.covariantequals;

public record SuppressionXpathRegressionCovariantEqualsInRecord() {
public record InputXpathCovariantEqualsInRecord() {

public boolean equals(String str) { // warn
return str.equals(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.classmemberimpliedmodifier;

public class SuppressionXpathRegressionClassMemberImpliedModifierTwo {
public class InputXpathClassMemberImpliedModifierEnum {
public enum Count { //warn
ONE, TWO, THREE;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.classmemberimpliedmodifier;

public class SuppressionXpathRegressionClassMemberImpliedModifierOne {
public class InputXpathClassMemberImpliedModifierInterface {
public interface Foo { //warn
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.commentsindentation;

public class SuppressionXpathRegressionCommentsIndentationBlock {
public class InputXpathCommentsIndentationBlock {
/* // warn
* Javadoc comment
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Arrays;

public class SuppressionXpathRegressionCommentsIndentationDistributedStatement {
public class InputXpathCommentsIndentationDistributedStatement {
public void foo() {
String s = "";
int n = s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.commentsindentation;

public class SuppressionXpathRegressionCommentsIndentationEmptyCase {
public class InputXpathCommentsIndentationEmptyCase {
int n;

public void foo() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.checkstyle.suppressionxpathfilter.commentsindentation;

public class SuppressionXpathRegressionCommentsIndentationNonEmptyCase {
public class InputXpathCommentsIndentationNonEmptyCase {
int n;

public void foo() {
Expand Down

0 comments on commit 542db1d

Please sign in to comment.