use of com.canoo.platform.spring.test.CommunicationMonitor in project dolphin-platform by canoo.
the class RunLaterControllerTest method testRunLaterAsyncInAction.
@Test
public void testRunLaterAsyncInAction() throws Exception {
// given:
final ControllerUnderTest<RunLaterTestBean> controller = createController(RUN_LATER_CONTROLLER_NAME);
final RunLaterTestBean model = controller.getModel();
final CommunicationMonitor monitor = controller.createMonitor();
model.actionRunLaterAsyncCallIndexProperty().onChanged(e -> {
monitor.signal();
});
// when:
controller.invoke(RUN_LATER_ASYNC_ACTION_NAME);
monitor.await(10, TimeUnit.SECONDS);
// then:
Assert.assertNotNull(model.getActionPreRunLaterAsyncCallIndex());
Assert.assertNotNull(model.getActionRunLaterAsyncCallIndex());
Assert.assertNotNull(model.getActionPostRunLaterAsyncCallIndex());
Assert.assertTrue(model.getActionPreRunLaterAsyncCallIndex() > 0);
Assert.assertTrue(model.getActionRunLaterAsyncCallIndex() > 0);
Assert.assertTrue(model.getActionPostRunLaterAsyncCallIndex() > 0);
Assert.assertTrue(model.getActionPreRunLaterAsyncCallIndex() < model.getActionPostRunLaterAsyncCallIndex());
Assert.assertTrue(model.getActionPostRunLaterAsyncCallIndex() < model.getActionRunLaterAsyncCallIndex());
}
Aggregations