Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #14715: Enforced new naming convention in IT area 16 #14795

Merged
merged 1 commit into from Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testOne() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionIllegalTypeOne.java"));
new File(getPath("InputXpathIllegalTypeOne.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(IllegalTypeCheck.class);
moduleConfig.addProperty("tokens", "METHOD_DEF");
Expand All @@ -50,7 +50,7 @@ public void testOne() throws Exception {
};
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionIllegalTypeOne']]"
+ "/CLASS_DEF[./IDENT[@text='InputXpathIllegalTypeOne']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='typeParam']]/TYPE_PARAMETERS/TYPE_PARAMETER"
+ "[./IDENT[@text='T']]/TYPE_UPPER_BOUNDS/DOT"
+ "[./IDENT[@text='HashSet']]/DOT/IDENT[@text='java']"
Expand All @@ -63,7 +63,7 @@ public void testOne() throws Exception {
@Test
public void testTwo() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to fix such names to match input suffix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or better to do this in separate PR ? I think so

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romani , in fact I've been changing respective test method names too in these PRs itself.. (#14795 (comment))

The problem with a few input files is that there is no proper design on how they have been introduced to our code by the authors. I'm unable to come up with meaningful suffixes for such files, and am leaving those abstract (One, Two, ....)

Rest assured, the input file suffixes and test names, I always make sure they match.
Even here, testTwo because it takes file InputXpathIllegalTypeTwo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks a lot for details

final File fileToProcess =
new File(getPath("SuppressionXpathRegressionIllegalTypeTwo.java"));
new File(getPath("InputXpathIllegalTypeTwo.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(IllegalTypeCheck.class);

Expand All @@ -74,7 +74,7 @@ public void testTwo() throws Exception {
IllegalTypeCheck.MSG_KEY, "Boolean"),
};
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionIllegalTypeTwo']"
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathIllegalTypeTwo']"
+ "]/OBJBLOCK/METHOD_DEF[./IDENT[@text='typeParam']]/TYPE_PARAMETERS/"
+ "TYPE_PARAMETER[./IDENT[@text='T']]/TYPE_UPPER_BOUNDS/IDENT[@text='Boolean']"
);
Expand Down
Expand Up @@ -38,9 +38,9 @@ protected String getCheckName() {
}

@Test
public void testFile1() throws Exception {
public void testInnerAssignment() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionInnerAssignment1.java"));
File(getPath("InputXpathInnerAssignment.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(InnerAssignmentCheck.class);

Expand All @@ -50,7 +50,7 @@ public void testFile1() throws Exception {

final List<String> expectedXpathQueries = List.of(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionInnerAssignment1']]"
+ "/CLASS_DEF[./IDENT[@text='InputXpathInnerAssignment']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]"
+ "/SLIST/EXPR/ASSIGN[./IDENT[@text='a']]/ASSIGN[./IDENT[@text='b']]"
);
Expand All @@ -59,9 +59,9 @@ public void testFile1() throws Exception {
}

@Test
public void testFile2() throws Exception {
public void testArrays() throws Exception {
final File fileToProcess = new
File(getPath("SuppressionXpathRegressionInnerAssignment2.java"));
File(getPath("InputXpathInnerAssignmentArrays.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(InnerAssignmentCheck.class);

Expand All @@ -71,12 +71,12 @@ public void testFile2() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionInnerAssignment2']]"
+ "/CLASS_DEF[./IDENT[@text='InputXpathInnerAssignmentArrays']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='doubleArray']]"
+ "/ASSIGN/EXPR/LITERAL_NEW/ARRAY_INIT/EXPR[./ASSIGN/IDENT[@text='myDouble']]",
"/COMPILATION_UNIT"
+ "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionInnerAssignment2']]"
+ "/CLASS_DEF[./IDENT[@text='InputXpathInnerAssignmentArrays']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]/"
+ "SLIST/VARIABLE_DEF[./IDENT[@text='doubleArray']]"
+ "/ASSIGN/EXPR/LITERAL_NEW/ARRAY_INIT/EXPR/ASSIGN[./IDENT[@text='myDouble']]"
Expand Down
Expand Up @@ -42,7 +42,7 @@ protected String getCheckName() {
@Test
public void testOne() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionInnerTypeLastOne.java"));
new File(getPath("InputXpathInnerTypeLastOne.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(InnerTypeLastCheck.class);

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

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

Expand All @@ -75,7 +75,7 @@ public void testOne() throws Exception {
public void testTwo() throws Exception {

final File fileToProcess =
new File(getPath("SuppressionXpathRegressionInnerTypeLastTwo.java"));
new File(getPath("InputXpathInnerTypeLastTwo.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(InnerTypeLastCheck.class);

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInnerTypeLastTwo']]"
+ "[@text='InputXpathInnerTypeLastTwo']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='innerMethod']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInnerTypeLastTwo']]"
+ "[@text='InputXpathInnerTypeLastTwo']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT"
+ "[@text='innerMethod']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInnerTypeLastTwo']]"
+ "[@text='InputXpathInnerTypeLastTwo']]"
+ "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT"
+ "[@text='innerMethod']]/MODIFIERS/LITERAL_PUBLIC"
Expand All @@ -109,7 +109,7 @@ public void testTwo() throws Exception {
public void testThree() throws Exception {

final File fileToProcess = new File(
getPath("SuppressionXpathRegressionInnerTypeLastThree.java"));
getPath("InputXpathInnerTypeLastThree.java"));

final DefaultConfiguration moduleConfig = createModuleConfig(InnerTypeLastCheck.class);

Expand All @@ -119,18 +119,18 @@ public void testThree() throws Exception {

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

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

@Test
public void testOne() throws Exception {
public void testAllowMarker() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionInterfaceIsType1.java"));
"InputXpathInterfaceIsTypeAllowMarker.java"));

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

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

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

@Test
public void testTwo() throws Exception {
public void testAllowMarkerFalse() throws Exception {
MANISH-K-07 marked this conversation as resolved.
Show resolved Hide resolved
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionInterfaceIsType2.java"));
"InputXpathInterfaceIsType.java"));

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

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

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

@Test
public void testOne() throws Exception {
public void testField() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionInterfaceMemberImpliedModifier1.java")
getPath("InputXpathInterfaceMemberImpliedModifierField.java")
);

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier1']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierField']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='str']]",

"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier1']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierField']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='str']]"
+ "/MODIFIERS",

"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier1']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierField']]"
+ "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='str']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);
Expand All @@ -69,9 +69,9 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testMethod() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionInterfaceMemberImpliedModifier2.java")
getPath("InputXpathInterfaceMemberImpliedModifierMethod.java")
);

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier2']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierMethod']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='setData']]",

"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier2']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierMethod']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='setData']]"
+ "/MODIFIERS",

"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier2']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierMethod']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='setData']]"
+ "/MODIFIERS/ABSTRACT"
);
Expand All @@ -102,9 +102,9 @@ public void testTwo() throws Exception {
}

@Test
public void testThree() throws Exception {
public void testInner() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionInterfaceMemberImpliedModifier3.java")
getPath("InputXpathInterfaceMemberImpliedModifierInner.java")
);

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier3']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierInner']]"
+ "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Data']]",

"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier3']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierInner']]"
+ "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Data']]"
+ "/MODIFIERS",

"/COMPILATION_UNIT/INTERFACE_DEF[./IDENT"
+ "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier3']]"
+ "[@text='InputXpathInterfaceMemberImpliedModifierInner']]"
+ "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Data']]"
+ "/MODIFIERS/LITERAL_PUBLIC"
);
Expand Down