From 70a27ed9386ee8d55d3580af22be7ade0b01460f Mon Sep 17 00:00:00 2001 From: Evgenii Skiridov Date: Tue, 7 Jul 2020 20:20:33 +0300 Subject: [PATCH] fix catch block --- library/build.gradle | 2 +- .../kopi/library/wait/ViewMatcherWaiter.kt | 22 +++++++------------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 842ad75..92904af 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -5,7 +5,7 @@ plugins { id 'digital.wup.android-maven-publish' version '3.6.3' } -version = "0.6.5" +version = "0.6.6" android { compileSdkVersion 29 diff --git a/library/src/main/java/com/qautomatron/kopi/library/wait/ViewMatcherWaiter.kt b/library/src/main/java/com/qautomatron/kopi/library/wait/ViewMatcherWaiter.kt index a7037b9..3649a8e 100644 --- a/library/src/main/java/com/qautomatron/kopi/library/wait/ViewMatcherWaiter.kt +++ b/library/src/main/java/com/qautomatron/kopi/library/wait/ViewMatcherWaiter.kt @@ -46,13 +46,10 @@ class ViewMatcherWaiter constructor(val viewMatcher: Matcher, val inRoot: return try { onView(viewMatcher).inRoot(inRoot).check(matches(viewChecker)) true - } catch (e: Exception) { - when(e) { - is AssertionError, is NoMatchingViewException -> { - return false - } - else -> throw e - } + } catch (e: AssertionError) { + false + } catch (e: NoMatchingViewException) { + false } } }) @@ -70,13 +67,10 @@ class ViewMatcherWaiter constructor(val viewMatcher: Matcher, val inRoot: return try { onView(viewMatcher).inRoot(inRoot).check(viewAssertion) true - } catch (e: Exception) { - when(e) { - is AssertionError, is NoMatchingViewException -> { - return false - } - else -> throw e - } + } catch (e: AssertionError) { + false + } catch (e: NoMatchingViewException) { + false } } })