Skip to content

Commit

Permalink
Issue #10562: Update inputs for OuterTypeFilenameCheckTest
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatj07 authored and romani committed Aug 5, 2021
1 parent c350a32 commit a1338ac
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 74 deletions.
52 changes: 0 additions & 52 deletions config/checkstyle_input_suppressions.xml
Expand Up @@ -620,32 +620,6 @@
<suppress id="ConfigCommentOnTopInputs"
files="nocodeinfile[\\/]InputNoCodeInFile5.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilename15Extensions.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilename1a.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilename1.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilename2.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilename3.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilename5.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilenameCheckPublic.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilenameIllegalTokens.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="outertypefilename[\\/]InputOuterTypeFilenameNoPublic.java"/>

<suppress id="ConfigCommentOnTopInputs"
files="packagenamesloader[\\/]InputPackageNamesLoaderNotXml.java"/>
Expand Down Expand Up @@ -1296,32 +1270,6 @@
<suppress id="StyleValidationCommentInInputs"
files="nocodeinfile[\\/]InputNoCodeInFile5.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilename15Extensions.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilename1a.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilename1.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilename2.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilename3.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilename5.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilenameCheckPublic.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilenameIllegalTokens.java"/>

<suppress id="StyleValidationCommentInInputs"
files="outertypefilename[\\/]InputOuterTypeFilenameNoPublic.java"/>

<suppress id="StyleValidationCommentInInputs"
files="packagenamesloader[\\/]InputPackageNamesLoaderNotXml.java"/>
Expand Down
Expand Up @@ -91,7 +91,7 @@ public void testNestedClass() throws Exception {
public void testNestedClass2() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(OuterTypeFilenameCheck.class);
final String[] expected = {
"3:1: " + getCheckMessage(MSG_KEY),
"9:1: " + getCheckMessage(MSG_KEY),
};
verify(checkConfig, getPath("InputOuterTypeFilename1a.java"), expected);
}
Expand All @@ -114,7 +114,7 @@ public void testPublicClassIsNotFirst() throws Exception {
public void testNoPublicClasses() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(OuterTypeFilenameCheck.class);
final String[] expected = {
"3:1: " + getCheckMessage(MSG_KEY),
"9:1: " + getCheckMessage(MSG_KEY),
};
verify(checkConfig, getPath("InputOuterTypeFilenameNoPublic.java"), expected);
}
Expand All @@ -130,7 +130,7 @@ public void testFineDefault() throws Exception {
public void testWrongDefault() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(OuterTypeFilenameCheck.class);
final String[] expected = {
"4:2: " + getCheckMessage(MSG_KEY),
"10:2: " + getCheckMessage(MSG_KEY),
};
verify(checkConfig, getPath("InputOuterTypeFilename5.java"), expected);
}
Expand All @@ -149,18 +149,19 @@ public void testOuterTypeFilenameRecords() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(OuterTypeFilenameCheck.class);

final String[] expected = {
"7:1: " + getCheckMessage(MSG_KEY),
"10:1: " + getCheckMessage(MSG_KEY),
};
verify(checkConfig,
getNonCompilablePath("InputOuterTypeFilenameRecord.java"), expected);
getNonCompilablePath("InputOuterTypeFilenameRecordMethodRecordDef.java"),
expected);
}

@Test
public void testOuterTypeFilenameRecordsMethodRecordDef() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(OuterTypeFilenameCheck.class);

final String[] expected = {
"7:1: " + getCheckMessage(MSG_KEY),
"10:1: " + getCheckMessage(MSG_KEY),
};
verify(checkConfig,
getNonCompilablePath("InputOuterTypeFilenameRecord.java"), expected);
Expand Down
@@ -1,8 +1,11 @@
/*
OuterTypeFilename
*/

//non-compiled with javac: contains different class name by demand of test
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

/* Config:
* default
*/
public record IncorrectName1(int x, int y, String str) { // violation
}
@@ -1,9 +1,12 @@
/*
OuterTypeFilename
*/

//non-compiled with javac: contains different class name by demand of test
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

/* Config:
* default
*/
public record IncorrectName2(int x, int y, String str) { // violation
class LocalRecordHelper {
Record recordMethod(int x) {
Expand Down
@@ -1,3 +1,9 @@
/*
OuterTypeFilename
*/

@Deprecated
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;
package com.puppycrawl.tools.checkstyle.checks.outertypefilename; // ok

@@ -1,7 +1,13 @@
/*
OuterTypeFilename
*/

// someexamples of 1.5 extensions
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

public class InputOuterTypeFilename1 {
public class InputOuterTypeFilename1 { // ok

public class UnicClassName {

Expand Down
@@ -1,7 +1,13 @@
/*
OuterTypeFilename
*/

// someexamples of 1.5 extensions
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

@interface MyAnnotation1 {
@interface MyAnnotation1 { // ok
String name();
int version();
}
Expand Down
@@ -1,6 +1,12 @@
/*
OuterTypeFilename
*/

package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

class Class1 {
class Class1 { // violation
public interface NestedInterface {}
public enum NestedEnum {}
class NestedClass {}
Expand Down
@@ -1,7 +1,13 @@
/*
OuterTypeFilename
*/

// someexamples of 1.5 extensions
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

public class InputOuterTypeFilename2 {
public class InputOuterTypeFilename2 { // ok


}
@@ -1,7 +1,13 @@
/*
OuterTypeFilename
*/

// someexamples of 1.5 extensions
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

class InputOuterTypeFilename3 {
class InputOuterTypeFilename3 { // ok


}
@@ -1,7 +1,13 @@
/*
OuterTypeFilename
*/

// someexamples of 1.5 extensions
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

class InputOuterTypeFilename5NameMismatch {
class InputOuterTypeFilename5NameMismatch { // violation


}
@@ -1,7 +1,13 @@
/*
OuterTypeFilename
*/

// someexamples of 1.5 extensions
package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

class UnicClassName {
class UnicClassName { // ok

}

Expand Down
@@ -1,6 +1,12 @@
/*
OuterTypeFilename
*/

package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

public class InputOuterTypeFilenameIllegalTokens
public class InputOuterTypeFilenameIllegalTokens // ok
{
public void methodWithPreviouslyIllegalTokens()
{
Expand Down
@@ -1,4 +1,10 @@
/*
OuterTypeFilename
*/

package com.puppycrawl.tools.checkstyle.checks.outertypefilename;

class Foo {}
class Foo {} // violation
enum FooEnum {}

0 comments on commit a1338ac

Please sign in to comment.