diff options
author | rnveach <rveach02@gmail.com> | 2015-10-15 19:54:31 -0400 |
---|---|---|
committer | rnveach <rveach02@gmail.com> | 2015-10-15 20:15:47 -0400 |
commit | 7e5e919ce7db115c5893fa23e07a3cf1acfc3f10 (patch) | |
tree | 674e141ce9e5fc406f9121fc9dcc5afd0dea2671 /src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming | |
parent | bf94ea4127b17c5ab6987ee2e294d2d4b6a1c20f (diff) | |
download | checkstyle-7e5e919ce7db115c5893fa23e07a3cf1acfc3f10.tar.gz |
Issue #2161: unify test input locations for naming package
Diffstat (limited to 'src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming')
7 files changed, 270 insertions, 0 deletions
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/AbstractMultisetSetCountTester.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/AbstractMultisetSetCountTester.java new file mode 100644 index 000000000..02a21ca54 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/AbstractMultisetSetCountTester.java @@ -0,0 +1,18 @@ +package com.puppycrawl.tools.checkstyle.checks.naming; + +public abstract class AbstractMultisetSetCountTester<E> { + + private static final String SUPPORTS_REMOVE = ""; + +@CollectionFeature.Require(absent = SUPPORTS_REMOVE) + public void testSetCount_negative_removeUnsupported() { + } +} + +@interface CollectionFeature { + + public @interface Require + { + String absent(); + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbbreviationAsWordInTypeNameCheck.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbbreviationAsWordInTypeNameCheck.java new file mode 100644 index 000000000..6dd9a7e14 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbbreviationAsWordInTypeNameCheck.java @@ -0,0 +1,104 @@ +package com.puppycrawl.tools.checkstyle.checks.naming; + +abstract class IIIInputAbstractClassName { +} + +abstract class NonAAAAbstractClassName { +} + +abstract class FactoryWithBADNAme { +} + +abstract class AbstractCLASSName { + abstract class NonAbstractInnerClass { + } +} + +abstract class ClassFactory1 { + abstract class WellNamedFactory { + } +} + +class NonAbstractClass1 { +} + +class AbstractClass1 { +} + +class Class1Factory1 { +} + +abstract class AbstractClassName3 { + class AbstractINNERRClass { + } +} + +abstract class Class3Factory { + class WellNamedFACTORY { + public void marazmaticMETHODName() { + int marazmaticVARIABLEName = 2; + int MARAZMATICVariableName = 1; + } + } +} + +interface Directions { + int RIGHT=1; + int LEFT=2; + int UP=3; + int DOWN=4; +} + +interface BadNameForInterfeis +{ + void interfaceMethod(); +} + +abstract class NonAAAAbstractClassName2 { + public int serialNUMBER = 6; + public final int s1erialNUMBER = 6; + private static int s2erialNUMBER = 6; + private static final int s3erialNUMBER = 6; +} + +interface Interface1 { + + String VALUEEEE = "value"; // in interface this is final/static + +} + +interface Interface2 { + + static String VALUEEEE = "value"; // in interface this is final/static + +} + +interface Interface3 { + + final String VALUEEEE = "value"; // in interface this is final/static + +} + +interface Interface4 { + + final static String VALUEEEE = "value"; // in interface this is final/static + +} + +class FIleNameFormatException extends Exception { + + private static final long serialVersionUID = 1L; + + public FIleNameFormatException(Exception e) { + super(e); + } +} + +class StateX { + int userID; + int scaleX, scaleY, scaleZ; + + int getScaleX() { + return this.scaleX; + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbbreviationAsWordInTypeNameCheckOverridableMethod.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbbreviationAsWordInTypeNameCheckOverridableMethod.java new file mode 100644 index 000000000..9c2031db7 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbbreviationAsWordInTypeNameCheckOverridableMethod.java @@ -0,0 +1,39 @@ +package com.puppycrawl.tools.checkstyle.checks.naming; + +import org.junit.Before; + +abstract class NonAAAAbstractClassName1 extends Class1 { + public int serialNUMBER = 6; + public final int s1erialNUMBER = 6; + private static int s2erialNUMBER = 6; + private static final int s3erialNUMBER = 6; + + @Override + @SuppressWarnings(value = { "" }) + @Before + protected void oveRRRRRrriddenMethod(){ + int a = 0; + // blah-blah + } +} + +class Class1 { + @SuppressWarnings(value = { "" }) + protected void oveRRRRRrriddenMethod(){ + int a = 0; + // blah-blah + } + +} + +class Class2 extends Class1 { + + @Override + @SuppressWarnings(value = { "" }) + @Before + protected void oveRRRRRrriddenMethod(){ + int a = 0; + // blah-blah + } + +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbstractClassName.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbstractClassName.java new file mode 100644 index 000000000..70f96bfbb --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbstractClassName.java @@ -0,0 +1,24 @@ +package com.puppycrawl.tools.checkstyle.checks.naming; + +abstract public class InputAbstractClassName { +} +// abstract --> ^Abstract.*$ +abstract class NonAbstractClassName { +} + +abstract class AbstractClassOther { + abstract class NonAbstractInnerClass { + } +} + +class NonAbstractClass { +} + +//^Abstract.*$ --> abstract +class AbstractClass { +} + +abstract class AbstractClassName2 { + class AbstractInnerClass { + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbstractClassNameFormerFalsePositive.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbstractClassNameFormerFalsePositive.java new file mode 100644 index 000000000..e1912ccbe --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAbstractClassNameFormerFalsePositive.java @@ -0,0 +1,12 @@ +package com.puppycrawl.tools.checkstyle.checks.naming; + +public class InputAbstractClassNameFormerFalsePositive +{ + class Abstract { + + } + + class AbstractClass { + + } +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputTypeName.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputTypeName.java new file mode 100644 index 000000000..fa7128d3a --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputTypeName.java @@ -0,0 +1,11 @@ +package com.puppycrawl.tools.checkstyle.checks.naming; + +class inputHeaderClass { + + public interface inputHeaderInterface {}; +//comment + public enum inputHeaderEnum { one, two }; + + public @interface inputHeaderAnnotation {}; + +} diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputTypeParameterName.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputTypeParameterName.java new file mode 100644 index 000000000..d003cdd37 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputTypeParameterName.java @@ -0,0 +1,62 @@ +package com.puppycrawl.tools.checkstyle.checks.naming; + +import java.io.Serializable; + +public class InputTypeParameterName <t> +{ + public <TT> void foo() { } + + <e_e> void foo(int i) { + } +} + +class Other <foo extends Serializable & Cloneable> { + + foo getOne() { + return null;//comment + } + + <Tfo$o2T extends foo> /*comment*/Tfo$o2T getTwo(Tfo$o2T a) { + return null; + } + + <foo extends Runnable> foo getShadow() { + return null; + } + + static class Junk <foo> { + <_fo extends foo> void getMoreFoo() { + } + } +} + +class MoreOther <T extends Cloneable> { + + <E extends T> void getMore() { + new Other() { + <T> void getMoreFoo() { + } + }; + +// Other o = new Other() { +// <EE> void getMoreFoo() { +// } +// }; + } +} + +interface Boo<Input> { + Input boo(); +} + +interface FooInterface<T> { + T foo(); +} + +interface FooInterface2 { + Input foo(); +} + +class Input { + +} |