Illegal Catch Check compilable UT inputs
This commit is contained in:
parent
ab50d42d93
commit
448a62c9a6
|
|
@ -67,10 +67,10 @@ public class IllegalCatchCheckTest extends BaseCheckTestSupport
|
|||
DefaultConfiguration checkConfig = createCheckConfig(IllegalCatchCheck.class);
|
||||
|
||||
String[] expected = {
|
||||
"6:11: Catching 'RuntimeException' is not allowed.",
|
||||
"8:11: Catching 'RuntimeException' is not allowed.",
|
||||
"7:11: Catching 'RuntimeException' is not allowed.",
|
||||
"10:11: Catching 'RuntimeException' is not allowed.",
|
||||
"12:11: Catching 'RuntimeException' is not allowed.",
|
||||
"13:11: Catching 'RuntimeException' is not allowed.",
|
||||
"16:11: Catching 'RuntimeException' is not allowed.",
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("coding" + File.separator + "InputIllegalCatchCheck2.java"), expected);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.coding;
|
||||
package com.puppycrawl.tools.checkstyle.coding;
|
||||
|
||||
public class InputIllegalCatchCheck {
|
||||
public void foo() {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,31 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.coding;
|
||||
package com.puppycrawl.tools.checkstyle.coding;
|
||||
|
||||
public class InputIllegalCatchCheck2 {
|
||||
public void foo() {
|
||||
public void foo() throws OneMoreException {
|
||||
try {
|
||||
} catch (RuntimeException | SQLException e) {
|
||||
foo1();
|
||||
} catch (RuntimeException | SQLException e) {}
|
||||
try {
|
||||
foo1();
|
||||
} catch (RuntimeException | SQLException | OneMoreException e) {}
|
||||
try {
|
||||
foo1();
|
||||
} catch (OneMoreException | RuntimeException | SQLException e) {}
|
||||
try {
|
||||
foo1();
|
||||
} catch (OneMoreException | SQLException | RuntimeException e) {}
|
||||
|
||||
} catch (RuntimeException | SQLException | OneMoreException e) {
|
||||
}
|
||||
|
||||
private void foo1() throws RuntimeException, SQLException, OneMoreException {
|
||||
|
||||
} catch (OneMoreException | RuntimeException | SQLException e) {
|
||||
}
|
||||
|
||||
} catch (OneMoreException | SQLException | RuntimeException e) {
|
||||
private class SQLException extends Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class OneMoreException extends Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue