@Test public void test_toString() { when(evaluator.source(any(Image.class))).thenReturn("http://localhost/myImage.jpg"); Image image = new Image(evaluator, id); assertThat(image.toString(), is("class org.testatoo.core.component.Image with state : enabled:true, visible:true, source:http://localhost/myImage.jpg")); } }
@Test public void can_test_image_source() { when(evaluator.source(any(Image.class))).thenReturn("http://localhost/myImage.jpg"); Image image = new Image(evaluator, id); assertThat(image.source(), is("http://localhost/myImage.jpg")); }
@Test public void test_component_type() { evaluator = mock(Evaluator.class); when(evaluator.existComponent(id)).thenReturn(true); when(evaluator.componentType(id)).thenReturn(Radio); try { new Image(evaluator, id); fail(); } catch (ComponentException e) { assertThat(e.getMessage(), is("The component with id=" + id + " is not a Image but a Radio")); } }