From b08ea45624d10cd6a3eac7da8c902de3dbb98f8c Mon Sep 17 00:00:00 2001 From: MANISH-K-07 Date: Mon, 12 Feb 2024 20:15:52 +0530 Subject: [PATCH] Issue #14436: Enforced naming convention for illegalcatch --- .../checks/coding/IllegalCatchCheckTest.java | 16 ++++++++-------- ... => InputIllegalCatchCheckDefaultTokens.java} | 2 +- ...nputIllegalCatchCheckMultipleExceptions.java} | 2 +- ...putIllegalCatchCheckSuperclassException.java} | 2 +- ...putIllegalCatchCheckSuperclassThrowable.java} | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) rename src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/{InputIllegalCatch.java => InputIllegalCatchCheckDefaultTokens.java} (93%) rename src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/{InputIllegalCatch2.java => InputIllegalCatchCheckMultipleExceptions.java} (94%) rename src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/{InputIllegalCatch4.java => InputIllegalCatchCheckSuperclassException.java} (91%) rename src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/{InputIllegalCatch3.java => InputIllegalCatchCheckSuperclassThrowable.java} (91%) diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java index bcf76d7f401..91497438fcd 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java @@ -34,7 +34,7 @@ protected String getPackageLocation() { } @Test - public void testDefault() throws Exception { + public void testIllegalCatchCheckDefaultTokens() throws Exception { final String[] expected = { "14:11: " + getCheckMessage(MSG_KEY, "RuntimeException"), @@ -46,11 +46,11 @@ public void testDefault() throws Exception { }; verifyWithInlineConfigParser( - getPath("InputIllegalCatch.java"), expected); + getPath("InputIllegalCatchCheckDefaultTokens.java"), expected); } @Test - public void testIllegalClassNames() throws Exception { + public void testIllegalCatchCheckSuperclassThrowable() throws Exception { final String[] expected = { "14:11: " + getCheckMessage(MSG_KEY, "Exception"), "15:11: " + getCheckMessage(MSG_KEY, "Throwable"), @@ -59,11 +59,11 @@ public void testIllegalClassNames() throws Exception { }; verifyWithInlineConfigParser( - getPath("InputIllegalCatch3.java"), expected); + getPath("InputIllegalCatchCheckSuperclassThrowable.java"), expected); } @Test - public void testIllegalClassNamesBad() throws Exception { + public void testIllegalCatchCheckSuperclassException() throws Exception { // check that incorrect names don't break the Check final String[] expected = { "15:11: " + getCheckMessage(MSG_KEY, "Exception"), @@ -71,11 +71,11 @@ public void testIllegalClassNamesBad() throws Exception { }; verifyWithInlineConfigParser( - getPath("InputIllegalCatch4.java"), expected); + getPath("InputIllegalCatchCheckSuperclassException.java"), expected); } @Test - public void testMultipleTypes() throws Exception { + public void testIllegalCatchCheckMultipleExceptions() throws Exception { final String[] expected = { "15:11: " + getCheckMessage(MSG_KEY, "RuntimeException"), "15:11: " + getCheckMessage(MSG_KEY, "SQLException"), @@ -91,7 +91,7 @@ public void testMultipleTypes() throws Exception { }; verifyWithInlineConfigParser( - getPath("InputIllegalCatch2.java"), expected); + getPath("InputIllegalCatchCheckMultipleExceptions.java"), expected); } @Test diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckDefaultTokens.java similarity index 93% rename from src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch.java rename to src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckDefaultTokens.java index e3ea4fc41bc..2f9e5907cb5 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckDefaultTokens.java @@ -8,7 +8,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding.illegalcatch; -public class InputIllegalCatch { +public class InputIllegalCatchCheckDefaultTokens { public void foo() { try { //class names } catch (RuntimeException e) { // violation diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch2.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckMultipleExceptions.java similarity index 94% rename from src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch2.java rename to src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckMultipleExceptions.java index 396513c3c53..1ace07ed795 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch2.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckMultipleExceptions.java @@ -8,7 +8,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding.illegalcatch; -public class InputIllegalCatch2 { +public class InputIllegalCatchCheckMultipleExceptions { public void foo() throws OneMoreException { try { foo1(); diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch4.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckSuperclassException.java similarity index 91% rename from src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch4.java rename to src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckSuperclassException.java index c04f4e43cf7..fce5240efae 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch4.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckSuperclassException.java @@ -8,7 +8,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding.illegalcatch; -public class InputIllegalCatch4 { +public class InputIllegalCatchCheckSuperclassException { public void foo() { try { //class names } catch (RuntimeException e) { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch3.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckSuperclassThrowable.java similarity index 91% rename from src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch3.java rename to src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckSuperclassThrowable.java index b200e197a73..0a0fce2264f 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatch3.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/illegalcatch/InputIllegalCatchCheckSuperclassThrowable.java @@ -7,7 +7,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding.illegalcatch; -public class InputIllegalCatch3 { +public class InputIllegalCatchCheckSuperclassThrowable { public void foo() { try { //class names } catch (RuntimeException e) {