use of com.canoo.platform.spring.test.ControllerUnderTest in project dolphin-platform-examples by canoo.
the class ToDoControllerTests method testElementStateSync.
@Test
public void testElementStateSync() {
// given:
ControllerUnderTest<ToDoList> controllerUnderTest = createController(TODO_CONTROLLER_NAME);
ControllerUnderTest<ToDoList> controllerUnderTest2 = createController(TODO_CONTROLLER_NAME);
// when:
controllerUnderTest.getModel().getNewItemText().set("Banana");
controllerUnderTest.invoke(ADD_ACTION);
controllerUnderTest.invoke(CHANGE_ACTION, new Param(ITEM_PARAM, "Banana"));
// then:
Assert.assertEquals(controllerUnderTest2.getModel().getItems().size(), 1);
Assert.assertEquals(controllerUnderTest2.getModel().getItems().get(0).isCompleted(), true);
}
use of com.canoo.platform.spring.test.ControllerUnderTest in project dolphin-platform-examples by canoo.
the class ToDoControllerTests method testChangeElementState.
@Test
public void testChangeElementState() {
// given:
ControllerUnderTest<ToDoList> controllerUnderTest = createController(TODO_CONTROLLER_NAME);
// when:
controllerUnderTest.getModel().getNewItemText().set("Banana");
controllerUnderTest.invoke(ADD_ACTION);
controllerUnderTest.invoke(CHANGE_ACTION, new Param(ITEM_PARAM, "Banana"));
// then:
Assert.assertEquals(controllerUnderTest.getModel().getItems().get(0).isCompleted(), true);
}
use of com.canoo.platform.spring.test.ControllerUnderTest in project dolphin-platform-examples by canoo.
the class ToDoControllerTests method testDeleteElement.
@Test
public void testDeleteElement() {
// given:
ControllerUnderTest<ToDoList> controllerUnderTest = createController(TODO_CONTROLLER_NAME);
// when:
controllerUnderTest.getModel().getNewItemText().set("Banana");
controllerUnderTest.invoke(ADD_ACTION);
controllerUnderTest.invoke(REMOVE_ACTION, new Param(ITEM_PARAM, "Banana"));
// then:
Assert.assertEquals(controllerUnderTest.getModel().getItems().size(), 0);
}
use of com.canoo.platform.spring.test.ControllerUnderTest in project dolphin-platform by canoo.
the class RunLaterControllerTest method testRunLaterInPostConstruct.
@Test
public void testRunLaterInPostConstruct() {
// given:
final ControllerUnderTest<RunLaterTestBean> controller = createController(RUN_LATER_CONTROLLER_NAME);
final RunLaterTestBean model = controller.getModel();
// then
Assert.assertNotNull(model.getPostConstructPreRunLaterCallIndex());
Assert.assertNotNull(model.getPostConstructRunLaterCallIndex());
Assert.assertNotNull(model.getPostConstructPostRunLaterCallIndex());
Assert.assertTrue(model.getPostConstructPreRunLaterCallIndex() > 0);
Assert.assertTrue(model.getPostConstructRunLaterCallIndex() > 0);
Assert.assertTrue(model.getPostConstructPostRunLaterCallIndex() > 0);
Assert.assertTrue(model.getPostConstructPreRunLaterCallIndex() < model.getPostConstructPostRunLaterCallIndex());
Assert.assertTrue(model.getPostConstructPostRunLaterCallIndex() < model.getPostConstructRunLaterCallIndex());
}
use of com.canoo.platform.spring.test.ControllerUnderTest in project dolphin-platform-examples by canoo.
the class ToDoControllerTests method testElementDeleteSync.
@Test
public void testElementDeleteSync() {
// given:
ControllerUnderTest<ToDoList> controllerUnderTest = createController(TODO_CONTROLLER_NAME);
ControllerUnderTest<ToDoList> controllerUnderTest2 = createController(TODO_CONTROLLER_NAME);
// when:
controllerUnderTest.getModel().getNewItemText().set("Banana");
controllerUnderTest.invoke(ADD_ACTION);
controllerUnderTest.invoke(REMOVE_ACTION, new Param(ITEM_PARAM, "Banana"));
// then:
Assert.assertEquals(controllerUnderTest2.getModel().getItems().size(), 0);
}
Aggregations