@Test public void shouldNotMatchConditionWhenTextDoesNotEqualValue() { when(mockWebElementConverter.getTextFrom(mockElement)).thenReturn("Test 2"); TextEqualsCondition condition = new TextEqualsCondition(mockWebElementConverter, false, "Test 1"); assertThat(condition.apply(mockElement), equalTo(false)); }
@Override public boolean apply(WebElement element) { try { final String elementText = StringNormaliser.normalise(webElementConverter.getTextFrom(element)); return ignoreCase ? elementText.equalsIgnoreCase(text) : elementText.equals(text); } catch (NullPointerException | WebDriverException e) { return false; } }
TextEqualsCondition extends Condition<WebElement> { @Override public boolean apply(WebElement element) { try { final String elementText = StringNormaliser.normalise(webElementConverter.getTextFrom(element)); return ignoreCase ? elementText.equalsIgnoreCase(text) : elementText.equals(text); } catch (NullPointerException | WebDriverException e) { return false; } } }
TextEqualsCondition extends Condition<WebElement> { @Override public boolean apply(WebElement element) { try { final String elementText = StringNormaliser.normalise(webElementConverter.getTextFrom(element)); return ignoreCase ? elementText.equalsIgnoreCase(text) : elementText.equals(text); } catch (NullPointerException | WebDriverException e) { return false; } } TextEqualsCondition(final String text);  TextEqualsCondition(final boolean ignoreCase, final String text);   TextEqualsCondition(final WebElementConverter webElementConverter, final boolean ignoreCase, final String text); }
TextEqualsCondition extends Condition<WebElement> { @Override public boolean apply(WebElement element) { try { final String elementText = StringNormaliser.normalise(webElementConverter.getTextFrom(element)); return ignoreCase ? elementText.equalsIgnoreCase(text) : elementText.equals(text); } catch (NullPointerException | WebDriverException e) { return false; } } TextEqualsCondition(final String text);  TextEqualsCondition(final boolean ignoreCase, final String text);   TextEqualsCondition(final WebElementConverter webElementConverter, final boolean ignoreCase, final String text); @Override boolean apply(WebElement element); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
TextEqualsCondition extends Condition<WebElement> { @Override public boolean apply(WebElement element) { try { final String elementText = StringNormaliser.normalise(webElementConverter.getTextFrom(element)); return ignoreCase ? elementText.equalsIgnoreCase(text) : elementText.equals(text); } catch (NullPointerException | WebDriverException e) { return false; } } TextEqualsCondition(final String text);  TextEqualsCondition(final boolean ignoreCase, final String text);   TextEqualsCondition(final WebElementConverter webElementConverter, final boolean ignoreCase, final String text); @Override boolean apply(WebElement element); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }