Search in sources :

Example 1 with Handler

use of org.linkki.util.handler.Handler in project linkki by linkki-framework.

the class BindingContextTest method setUpPmoWithAfterUpdateUiHandler.

private Handler setUpPmoWithAfterUpdateUiHandler() {
    Handler afterUpdateUi = mock(Handler.class);
    context = TestBindingContext.create(afterUpdateUi);
    pmo.setModelObject(modelObject);
    return afterUpdateUi;
}
Also used : Handler(org.linkki.util.handler.Handler)

Example 2 with Handler

use of org.linkki.util.handler.Handler in project linkki by linkki-framework.

the class BindingContextTest method testUpdateUIBindings_noBindingInContext.

@Test
public void testUpdateUIBindings_noBindingInContext() {
    Handler afterUpdateUi = setUpPmoWithAfterUpdateUiHandler();
    setUpBinding1();
    binding1 = spy(binding1);
    context.uiUpdated();
    verify(binding1, never()).updateFromPmo();
    verify(binding1, never()).displayMessages(any(MessageList.class));
    verify(afterUpdateUi, never()).apply();
}
Also used : Handler(org.linkki.util.handler.Handler) MessageList(org.linkki.core.message.MessageList) Test(org.junit.Test)

Example 3 with Handler

use of org.linkki.util.handler.Handler in project linkki by linkki-framework.

the class BindingContextTest method testUpdateUIBindingsAndValidate_noBindingInContext.

@Test
public void testUpdateUIBindingsAndValidate_noBindingInContext() {
    Handler afterUpdateUi = setUpPmoWithAfterUpdateUiHandler();
    setUpBinding1();
    binding1 = spy(binding1);
    context.updateUI();
    verify(afterUpdateUi).apply();
}
Also used : Handler(org.linkki.util.handler.Handler) Test(org.junit.Test)

Example 4 with Handler

use of org.linkki.util.handler.Handler in project linkki by linkki-framework.

the class HandlerTest method testAndThen.

@Test
public void testAndThen() {
    TestOkHandler h1 = new TestOkHandler();
    TestOkHandler h2 = new TestOkHandler();
    Handler composed = h1.andThen(h2);
    composed.apply();
    assertThat(handlerStack.size(), is(2));
    assertThat(handlerStack.pop(), is(h2));
    assertThat(handlerStack.pop(), is(h1));
}
Also used : Handler(org.linkki.util.handler.Handler) Test(org.junit.Test)

Example 5 with Handler

use of org.linkki.util.handler.Handler in project linkki by linkki-framework.

the class ConfirmationDialogTest method testCancelCallsOk.

@Test
public void testCancelCallsOk() {
    Handler handler = mock(Handler.class);
    ConfirmationDialog dialog = new ConfirmationDialog("", new Label(), handler);
    dialog.cancel();
    verify(handler).apply();
}
Also used : Label(com.vaadin.ui.Label) Handler(org.linkki.util.handler.Handler) Test(org.junit.Test)

Aggregations

Handler (org.linkki.util.handler.Handler)8 Test (org.junit.Test)7 Label (com.vaadin.ui.Label)1 LinkkiAspectDefinition (org.linkki.core.binding.aspect.definition.LinkkiAspectDefinition)1 MessageList (org.linkki.core.message.MessageList)1 LabelComponentWrapper (org.linkki.core.ui.components.LabelComponentWrapper)1