/** * To know if the component is disabled * * @return True if the component is disabled */ public Boolean isDisabled() { return !isEnabled(); }
/** * Uses the matcher Enabled to know if a given component is enabled using the syntax "is(enabled())" or "is(not(enabled())" * * @param component the graphic object * @return True if the component is enabled */ @Override public boolean matchesSafely(Component component) { return component.isEnabled(); }
/** * To get the string describing the component * * @return the string describing the component */ @Override public String toString() { return this.getClass().toString() + " with state : enabled:" + isEnabled() + ", visible:" + isVisible(); }
@Test public void component_enability() { when(evaluator.isEnabled(any(Component.class))).thenReturn(true, true, false, false); Component enabledComponent = new Component(evaluator, id); Component disabledComponent = new Component(evaluator, id); assertThat(enabledComponent.isEnabled(), is(true)); assertThat(enabledComponent.isDisabled(), is(false)); assertThat(disabledComponent.isDisabled(), is(true)); assertThat(disabledComponent.isEnabled(), is(false)); verify(evaluator, times(4)).isEnabled(any(Component.class)); }