Use multi-catch in test code. #1555

Fixes `TryWithIdenticalCatches` inspection violations in test code.

Description:
>Reports identical catch sections in try blocks under JDK 7. A quickfix is available to collapse the sections into a multi-catch section.
This inspection only reports if the project or module is configured to use a language level of 7.0 or higher.
This commit is contained in:
Michal Kordas 2015-08-20 21:22:52 +02:00 committed by Roman Ivanov
parent 8d898f7ceb
commit d3dcf0474a
2 changed files with 2 additions and 8 deletions

View File

@ -486,10 +486,7 @@ public class ConfigurationLoaderTest {
final Configuration[] children = config.getChildren();
assertEquals(0, children[0].getChildren().length);
}
catch (CheckstyleException ex) {
fail("unexpected exception");
}
catch (FileNotFoundException e) {
catch (CheckstyleException | FileNotFoundException ex) {
fail("unexpected exception");
}
}

View File

@ -233,10 +233,7 @@ public class UtilsTest {
assertEquals("given id " + id, expected.getMessage());
}
catch (IllegalAccessException e) {
fail();
}
catch (NoSuchFieldException e) {
catch (IllegalAccessException | NoSuchFieldException e) {
fail();
}
}