@Test public void shouldMatchConditionWhenAllConditionsAreMet() { when(mockElement.getAttribute("class")).thenReturn("menu active"); when(mockElement.isDisplayed()).thenReturn(true); when(mockElement.isEnabled()).thenReturn(true); AndCondition<WebElement> condition = displayed.and(enabled).and(attributeContains("class", "active")); assertThat(condition.apply(mockElement), equalTo(true)); }
@Override public boolean apply(final T t) { try { for (final Condition<T> condition : conditions) { if (!condition.apply(t)) return false; } return true; } catch (Exception e) { return false; } }
AndCondition extends Condition<T> { @Override public boolean apply(final T t) { try { for (final Condition<T> condition : conditions) { if (!condition.apply(t)) return false; } return true; } catch (Exception e) { return false; } } }
AndCondition extends Condition<T> { @Override public boolean apply(final T t) { try { for (final Condition<T> condition : conditions) { if (!condition.apply(t)) return false; } return true; } catch (Exception e) { return false; } } @SafeVarargs  AndCondition(final Condition<T>... conditions); }
AndCondition extends Condition<T> { @Override public boolean apply(final T t) { try { for (final Condition<T> condition : conditions) { if (!condition.apply(t)) return false; } return true; } catch (Exception e) { return false; } } @SafeVarargs  AndCondition(final Condition<T>... conditions); @Override boolean apply(final T t); @Override String toString(); }
AndCondition extends Condition<T> { @Override public boolean apply(final T t) { try { for (final Condition<T> condition : conditions) { if (!condition.apply(t)) return false; } return true; } catch (Exception e) { return false; } } @SafeVarargs  AndCondition(final Condition<T>... conditions); @Override boolean apply(final T t); @Override String toString();  }