diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheckTest.java index c54a14278f77..7ca811f4e775 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheckTest.java @@ -36,7 +36,9 @@ public class ClassTypeParameterNameCheckTest @Override protected String getPath(String filename) throws IOException { return super.getPath("checks" + File.separator - + "naming" + File.separator + filename); + + "naming" + File.separator + + "classtypeparametername" + File.separator + + filename); } @Test @@ -56,11 +58,11 @@ public void testClassDefault() final String pattern = "^[A-Z]$"; final String[] expected = { - "5:38: " + getCheckMessage(MSG_INVALID_PATTERN, "t", pattern), + "5:42: " + getCheckMessage(MSG_INVALID_PATTERN, "t", pattern), "13:14: " + getCheckMessage(MSG_INVALID_PATTERN, "foo", pattern), "27:24: " + getCheckMessage(MSG_INVALID_PATTERN, "foo", pattern), }; - verify(checkConfig, getPath("InputTypeParameterName.java"), expected); + verify(checkConfig, getPath("InputClassTypeParameterName.java"), expected); } @Test @@ -73,10 +75,10 @@ public void testClassFooName() final String pattern = "^foo$"; final String[] expected = { - "5:38: " + getCheckMessage(MSG_INVALID_PATTERN, "t", pattern), + "5:42: " + getCheckMessage(MSG_INVALID_PATTERN, "t", pattern), "33:18: " + getCheckMessage(MSG_INVALID_PATTERN, "T", pattern), }; - verify(checkConfig, getPath("InputTypeParameterName.java"), expected); + verify(checkConfig, getPath("InputClassTypeParameterName.java"), expected); } @Test diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/classtypeparametername/InputClassTypeParameterName.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/classtypeparametername/InputClassTypeParameterName.java new file mode 100644 index 000000000000..101bbc8e88ed --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/classtypeparametername/InputClassTypeParameterName.java @@ -0,0 +1,62 @@ +package com.puppycrawl.tools.checkstyle.checks.naming.classtypeparametername; + +import java.io.Serializable; + +public class InputClassTypeParameterName +{ + public void foo() { } + + void foo(int i) { + } +} + +class Other { + + foo getOne() { + return null;//comment + } + + /*comment*/Tfo$o2T getTwo(Tfo$o2T a) { + return null; + } + + foo getShadow() { + return null; + } + + static class Junk { + <_fo extends foo> void getMoreFoo() { + } + } +} + +class MoreOther { + + void getMore() { + new Other() { + void getMoreFoo() { + } + }; + +// Other o = new Other() { +// void getMoreFoo() { +// } +// }; + } +} + +interface Boo { + Input boo(); +} + +interface FooInterface { + T foo(); +} + +interface FooInterface2 { + Input foo(); +} + +class Input { + +}