@Test public void shouldHandleExceptionWhenElementHasStaleReference() { when(mockWebElementConverter.getTextFrom(mockElement)).thenThrow(new StaleElementReferenceException("stale")); EmptyCondition condition = new EmptyCondition(mockWebElementConverter); assertThat(condition.apply(mockElement), equalTo(false)); }
@Override public boolean apply(final WebElement element) { try { return webElementConverter.getTextFrom(element).isEmpty(); } catch (NullPointerException | WebDriverException e) { return false; } }
EmptyCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return webElementConverter.getTextFrom(element).isEmpty(); } catch (NullPointerException | WebDriverException e) { return false; } } }
EmptyCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return webElementConverter.getTextFrom(element).isEmpty(); } catch (NullPointerException | WebDriverException e) { return false; } } EmptyCondition();   EmptyCondition(final WebElementConverter webElementConverter); }
EmptyCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return webElementConverter.getTextFrom(element).isEmpty(); } catch (NullPointerException | WebDriverException e) { return false; } } EmptyCondition();   EmptyCondition(final WebElementConverter webElementConverter); @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
EmptyCondition extends Condition<WebElement> { @Override public boolean apply(final WebElement element) { try { return webElementConverter.getTextFrom(element).isEmpty(); } catch (NullPointerException | WebDriverException e) { return false; } } EmptyCondition();   EmptyCondition(final WebElementConverter webElementConverter); @Override boolean apply(final WebElement element); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }