Use multi-catch when possible
This commit is contained in:
@@ -87,20 +87,13 @@ public class KotlinLightClassCoherenceTest extends KotlinAsJavaTestBase {
|
||||
}
|
||||
|
||||
public void assertPropertyCoherent(KtLightClass lightClass, String methodName) {
|
||||
Class<?> reflect = PsiClass.class;
|
||||
try {
|
||||
Method method = reflect.getMethod(methodName);
|
||||
Method method = PsiClass.class.getMethod(methodName);
|
||||
Object lightResult = method.invoke(lightClass);
|
||||
Object delegateResult = method.invoke(lightClass.getClsDelegate());
|
||||
assertEquals("Result of method " + methodName + "() differs in light class and its delegate", delegateResult, lightResult);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,12 +142,9 @@ public class StdlibTest extends KotlinTestWithEnvironment {
|
||||
return TestCase.class.isAssignableFrom(aClass) ? new TestSuite(aClass) :
|
||||
TestRunnerUtil.isJUnit4TestClass(aClass) ? new JUnit4TestAdapter(aClass) : null;
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
catch (NoSuchMethodException | ClassNotFoundException e) {
|
||||
// Ignore test classes we can't instantiate
|
||||
return null;
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user