Skip to content

Commit

Permalink
Issue checkstyle#8151: Update XpathRegressionOuterTypeNumber to have …
Browse files Browse the repository at this point in the history
…atleast 2 tests
  • Loading branch information
Gaurav-Punjabi authored and romani committed Apr 28, 2020
1 parent 16ffa41 commit c473838
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 0 additions & 2 deletions config/checkstyle_non_main_files_suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@
files="src[\\/]it[\\/]java[\\/]org[\\/]checkstyle[\\/]suppressionxpathfilter[\\/]XpathRegressionNestedTryDepthTest.java"/>
<suppress id="numberOfTestCasesInXpath"
files="src[\\/]it[\\/]java[\\/]org[\\/]checkstyle[\\/]suppressionxpathfilter[\\/]XpathRegressionOneTopLevelClassTest.java"/>
<suppress id="numberOfTestCasesInXpath"
files="src[\\/]it[\\/]java[\\/]org[\\/]checkstyle[\\/]suppressionxpathfilter[\\/]XpathRegressionOuterTypeNumberTest.java"/>
<suppress id="numberOfTestCasesInXpath"
files="src[\\/]it[\\/]java[\\/]org[\\/]checkstyle[\\/]suppressionxpathfilter[\\/]XpathRegressionSuppressWarningsHolderTest.java"/>
<suppress id="numberOfTestCasesInXpath"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,28 @@ protected String getCheckName() {
}

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

final DefaultConfiguration moduleConfig =
createModuleConfig(OuterTypeNumberCheck.class);

final String[] expectedViolation = {
"1:1: " + getCheckMessage(OuterTypeNumberCheck.class,
OuterTypeNumberCheck.MSG_KEY, 2, 1),
};

final List<String> expectedXpathQueries = Collections.singletonList(
"/PACKAGE_DEF"
);

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

@Test
public void testMax() throws Exception {
final File fileToProcess =
new File(getPath("SuppressionXpathRegressionOuterTypeNumber.java"));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.checkstyle.suppressionxpathfilter.outertypenumber; // warn

public class SuppressionXpathRegressionOuterTypeNumberDefault {
public void test() {}
}

interface Constants {
int X = 10;
}

0 comments on commit c473838

Please sign in to comment.