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 19 #14802

Merged
merged 1 commit into from Apr 23, 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,9 +40,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testSimple() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclaration.java"));
"InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationSimple.java"));
final DefaultConfiguration moduleConfig = createModuleConfig(CLASS);
final String[] expectedViolation = {
"5:2: " + getCheckMessage(CLASS,
Expand All @@ -56,9 +56,9 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testInnerTypes() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes"
"InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes"
+ ".java"));
final DefaultConfiguration moduleConfig = createModuleConfig(CLASS);
final String[] expectedViolation = {
Expand Down
Expand Up @@ -42,7 +42,7 @@ protected String getCheckName() {
@Test
public void testDefault() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration.java"));
"InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationDefault.java"));
final DefaultConfiguration moduleConfig = createModuleConfig(CLASS);
final String[] expectedViolation = {
"4:20: " + getCheckMessage(CLASS,
Expand All @@ -52,7 +52,7 @@ public void testDefault() throws Exception {
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT"
+ "[@text="
+ "'SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration']]"
+ "'InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationDefault']]"
+ "/OBJBLOCK/SEMI"
);

Expand All @@ -62,7 +62,7 @@ public void testDefault() throws Exception {
@Test
public void testTokens() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTokens"
"InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationTokens"
+ ".java"));
final DefaultConfiguration moduleConfig = createModuleConfig(CLASS);
moduleConfig.addProperty("tokens", "METHOD_DEF");
Expand All @@ -74,7 +74,7 @@ public void testTokens() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[."
+ "/IDENT[@text='SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMember"
+ "/IDENT[@text='InputXpathUnnecessarySemicolonAfterTypeMember"
+ "DeclarationTokens']]"
+ "/OBJBLOCK/SEMI[1]"
);
Expand Down
Expand Up @@ -40,9 +40,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testSimple() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionUnnecessarySemicolonInEnumeration.java"));
getPath("InputXpathUnnecessarySemicolonInEnumerationSimple.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(UnnecessarySemicolonInEnumerationCheck.class);
Expand All @@ -60,9 +60,9 @@ public void testOne() throws Exception {
}

@Test
public void testTwo() throws Exception {
public void testAll() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionUnnecessarySemicolonInEnumerationAll.java"
"InputXpathUnnecessarySemicolonInEnumerationAll.java"
));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/ENUM_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionUnnecessarySemicolonInEnumerationAll']]"
+ "'InputXpathUnnecessarySemicolonInEnumerationAll']]"
+ "/OBJBLOCK/SEMI"
);

Expand Down
Expand Up @@ -42,7 +42,7 @@ protected String getCheckName() {
@Test
public void testDefault() throws Exception {
final File fileToProcess = new File(
getPath("SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources.java"));
getPath("InputXpathUnnecessarySemicolonInTryWithResourcesDefault.java"));
final DefaultConfiguration moduleConfig =
createModuleConfig(UnnecessarySemicolonInTryWithResourcesCheck.class);
final String[] expectedViolation = {
Expand All @@ -51,17 +51,17 @@ public void testDefault() throws Exception {
};
final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources']]"
+ "'InputXpathUnnecessarySemicolonInTryWithResourcesDefault']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='m']]/SLIST/LITERAL_TRY"
+ "/RESOURCE_SPECIFICATION/SEMI"
);
runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries);
}

@Test
public void testAllowWhenNoBraceAfterSemicolon() throws Exception {
public void testNoBrace() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace.java"
"InputXpathUnnecessarySemicolonInTryWithResourcesNoBrace.java"
));

final DefaultConfiguration moduleConfig =
Expand All @@ -75,7 +75,7 @@ public void testAllowWhenNoBraceAfterSemicolon() throws Exception {

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace']]"
+ "'InputXpathUnnecessarySemicolonInTryWithResourcesNoBrace']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/LITERAL_TRY/RESOURCE_SPECIFICATION/SEMI"
);
Expand Down
Expand Up @@ -38,9 +38,9 @@ protected String getCheckName() {
}

@Test
public void testOne() throws Exception {
public void testUnusedImports() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionUnusedImportsOne.java"));
new File(getPath("InputXpathUnusedImports.java"));

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

@Test
public void testTwo() throws Exception {
public void testStatic() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionUnusedImportsTwo.java"));
new File(getPath("InputXpathUnusedImportsStatic.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(UnusedImportsCheck.class);
Expand Down
Expand Up @@ -39,7 +39,7 @@ protected String getCheckName() {
@Test
public void testOne() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionUnusedLocalVariableOne.java"));
"InputXpathUnusedLocalVariableOne.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(UnusedLocalVariableCheck.class);
Expand All @@ -51,18 +51,18 @@ public void testOne() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionUnusedLocalVariableOne']]/OBJBLOCK/"
+ "@text='InputXpathUnusedLocalVariableOne']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[./IDENT[@text='a']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionUnusedLocalVariableOne']]/OBJBLOCK/"
+ "@text='InputXpathUnusedLocalVariableOne']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF["
+ "./IDENT[@text='a']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionUnusedLocalVariableOne']]/OBJBLOCK/"
+ "@text='InputXpathUnusedLocalVariableOne']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF["
+ "./IDENT[@text='a']]/TYPE",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionUnusedLocalVariableOne']]/OBJBLOCK/"
+ "@text='InputXpathUnusedLocalVariableOne']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF["
+ "./IDENT[@text='a']]/TYPE/LITERAL_INT"
);
Expand All @@ -74,7 +74,7 @@ public void testOne() throws Exception {
@Test
public void testTwo() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionUnusedLocalVariableTwo.java"));
"InputXpathUnusedLocalVariableTwo.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(UnusedLocalVariableCheck.class);
Expand All @@ -86,17 +86,17 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionUnusedLocalVariableTwo']]/OBJBLOCK/"
+ "@text='InputXpathUnusedLocalVariableTwo']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[./IDENT[@text='b']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionUnusedLocalVariableTwo']]/OBJBLOCK/"
+ "@text='InputXpathUnusedLocalVariableTwo']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF["
+ "./IDENT[@text='b']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionUnusedLocalVariableTwo']]/OBJBLOCK/"
+ "@text='InputXpathUnusedLocalVariableTwo']]/OBJBLOCK/"
+ "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF["
+ "./IDENT[@text='b']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF["
+ "./IDENT[@text='SuppressionXpathRegressionUnusedLocalVariableTwo']]/"
+ "./IDENT[@text='InputXpathUnusedLocalVariableTwo']]/"
+ "OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF["
+ "./IDENT[@text='b']]/TYPE/LITERAL_INT"
);
Expand Down
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testUpperEllOne() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionUpperEllFirst.java"));
new File(getPath("InputXpathUpperEllOne.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(UpperEllCheck.class);
Expand All @@ -52,10 +52,10 @@ public void testUpperEllOne() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionUpperEllFirst']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathUpperEllOne']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR[./NUM_LONG[@text='0l']]",
"/COMPILATION_UNIT/CLASS_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionUpperEllFirst']]/OBJBLOCK"
+ "[./IDENT[@text='InputXpathUpperEllOne']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR"
+ "/NUM_LONG[@text='0l']"
);
Expand All @@ -67,7 +67,7 @@ public void testUpperEllOne() throws Exception {
@Test
public void testUpperEllTwo() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionUpperEllSecond.java"));
new File(getPath("InputXpathUpperEllTwo.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(UpperEllCheck.class);
Expand All @@ -79,11 +79,11 @@ public void testUpperEllTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/INTERFACE_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionUpperEllSecond']]/OBJBLOCK/METHOD_DEF"
+ "[./IDENT[@text='InputXpathUpperEllTwo']]/OBJBLOCK/METHOD_DEF"
+ "[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT[@text='var2']]/ASSIGN/EXPR"
+ "[./NUM_LONG[@text='508987l']]",
"/COMPILATION_UNIT/INTERFACE_DEF"
+ "[./IDENT[@text='SuppressionXpathRegressionUpperEllSecond']]/OBJBLOCK/METHOD_DEF"
+ "[./IDENT[@text='InputXpathUpperEllTwo']]/OBJBLOCK/METHOD_DEF"
+ "[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT[@text='var2']]/ASSIGN/EXPR"
+ "/NUM_LONG[@text='508987l']"
);
Expand Down
Expand Up @@ -39,7 +39,7 @@ protected String getCheckName() {
@Test
public void testOne() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionVariableDeclarationUsageDistance1.java"));
"InputXpathVariableDeclarationUsageDistanceOne.java"));

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

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionVariableDeclarationUsageDistance1']]/"
+ "'InputXpathVariableDeclarationUsageDistanceOne']]/"
+ "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='temp']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionVariableDeclarationUsageDistance1']]/"
+ "'InputXpathVariableDeclarationUsageDistanceOne']]/"
+ "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='temp']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionVariableDeclarationUsageDistance1']]/"
+ "'InputXpathVariableDeclarationUsageDistanceOne']]/"
+ "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='temp']]/TYPE",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionVariableDeclarationUsageDistance1']]/"
+ "'InputXpathVariableDeclarationUsageDistanceOne']]/"
+ "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='temp']]/TYPE/LITERAL_INT"
);
Expand All @@ -79,7 +79,7 @@ public void testOne() throws Exception {
@Test
public void testTwo() throws Exception {
final File fileToProcess = new File(getPath(
"SuppressionXpathRegressionVariableDeclarationUsageDistance2.java"));
"InputXpathVariableDeclarationUsageDistanceTwo.java"));

final DefaultConfiguration moduleConfig =
createModuleConfig(VariableDeclarationUsageDistanceCheck.class);
Expand All @@ -96,19 +96,19 @@ public void testTwo() throws Exception {

final List<String> expectedXpathQueries = Arrays.asList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionVariableDeclarationUsageDistance2']]"
+ "'InputXpathVariableDeclarationUsageDistanceTwo']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod2']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='count']]",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionVariableDeclarationUsageDistance2']]"
+ "'InputXpathVariableDeclarationUsageDistanceTwo']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod2']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='count']]/MODIFIERS",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionVariableDeclarationUsageDistance2']]"
+ "'InputXpathVariableDeclarationUsageDistanceTwo']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod2']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='count']]/TYPE",
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text="
+ "'SuppressionXpathRegressionVariableDeclarationUsageDistance2']]"
+ "'InputXpathVariableDeclarationUsageDistanceTwo']]"
+ "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod2']]"
+ "/SLIST/VARIABLE_DEF[./IDENT[@text='count']]/TYPE/LITERAL_INT"
);
Expand Down
Expand Up @@ -40,7 +40,7 @@ protected String getCheckName() {
@Test
public void testWhitespaceAfterTypecast() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionWhitespaceAfterTypecast.java"));
new File(getPath("InputXpathWhitespaceAfterTypecast.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionWhitespaceAfterTypecast']]/OBJBLOCK"
+ "@text='InputXpathWhitespaceAfterTypecast']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/TYPECAST/RPAREN"
);

Expand All @@ -63,7 +63,7 @@ public void testWhitespaceAfterTypecast() throws Exception {
@Test
public void testWhitespaceAfterNotFollowed() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionWhitespaceAfterNotFollowed.java"));
new File(getPath("InputXpathWhitespaceAfterNotFollowed.java"));

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

final List<String> expectedXpathQueries = Collections.singletonList(
"/COMPILATION_UNIT/CLASS_DEF[./IDENT["
+ "@text='SuppressionXpathRegressionWhitespaceAfterNotFollowed']]/OBJBLOCK"
+ "@text='InputXpathWhitespaceAfterNotFollowed']]/OBJBLOCK"
+ "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/ARRAY_INIT/COMMA"
);

Expand Down