@Test public void test_alertbox_message() { AlertBox alertBox = new AlertBox(evaluator, id); when(evaluator.message(alertBox)).thenReturn("message"); assertThat(alertBox.message(), is("message")); }
@Test public void test_toString() { AlertBox alertBox = new AlertBox(evaluator, id); when(evaluator.isVisible(alertBox)).thenReturn(true); when(evaluator.isEnabled(alertBox)).thenReturn(true); when(evaluator.title(alertBox)).thenReturn("title"); when(evaluator.message(alertBox)).thenReturn("message"); assertThat(alertBox.toString(), is("class org.testatoo.core.component.AlertBox with state : enabled:true, visible:true, title:title, message:message")); } }
@Test public void test_component_type() { evaluator = mock(Evaluator.class); when(evaluator.existComponent(id)).thenReturn(true); when(evaluator.componentType(id)).thenReturn(Radio); try { new AlertBox(evaluator, id); fail(); } catch (ComponentException e) { assertThat(e.getMessage(), is("The component with id=" + id + " is not a AlertBox but a Radio")); } }