Search in sources :

Example 1 with ToDoList

use of com.canoo.platform.samples.distribution.common.model.ToDoList 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);
}
Also used : ToDoList(com.canoo.platform.samples.distribution.common.model.ToDoList) Param(com.canoo.platform.remoting.client.Param) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) Test(org.testng.annotations.Test) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Example 2 with ToDoList

use of com.canoo.platform.samples.distribution.common.model.ToDoList 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);
}
Also used : ToDoList(com.canoo.platform.samples.distribution.common.model.ToDoList) Param(com.canoo.platform.remoting.client.Param) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) Test(org.testng.annotations.Test) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Example 3 with ToDoList

use of com.canoo.platform.samples.distribution.common.model.ToDoList 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);
}
Also used : ToDoList(com.canoo.platform.samples.distribution.common.model.ToDoList) Param(com.canoo.platform.remoting.client.Param) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) Test(org.testng.annotations.Test) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Example 4 with ToDoList

use of com.canoo.platform.samples.distribution.common.model.ToDoList 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);
}
Also used : ToDoList(com.canoo.platform.samples.distribution.common.model.ToDoList) Param(com.canoo.platform.remoting.client.Param) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringTestNGControllerTest(com.canoo.platform.spring.test.SpringTestNGControllerTest) Test(org.testng.annotations.Test) ControllerUnderTest(com.canoo.platform.spring.test.ControllerUnderTest)

Aggregations

Param (com.canoo.platform.remoting.client.Param)4 ToDoList (com.canoo.platform.samples.distribution.common.model.ToDoList)4 ControllerUnderTest (com.canoo.platform.spring.test.ControllerUnderTest)4 SpringTestNGControllerTest (com.canoo.platform.spring.test.SpringTestNGControllerTest)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 Test (org.testng.annotations.Test)4