Search in sources :

Example 1 with WidgetBinding

use of org.malai.binding.WidgetBinding in project Malai by arnobl.

the class TestInteractor method testInteractionStartsOkCauseOfTheNonPublicAction.

@Test
void testInteractionStartsOkCauseOfTheNonPublicAction() throws CancelFSMException {
    final boolean[] ok = { false };
    ErrorCatcher.INSTANCE.setNotifier(exception -> ok[0] = true);
    StubInstrument ins = new StubInstrument();
    WidgetBinding interactor2 = new WidgetBindingImpl<CommandImplStub2, InteractionMock, StubInstrument>(ins, false, CommandImplStub2.class, new InteractionMock()) {

        @Override
        public void first() {
        }

        @Override
        public boolean when() {
            return true;
        }

        @Override
        protected void executeCmdAsync(final Command cmd) {
        }
    };
    ins.setActivated(true);
    interactor2.fsmStarts();
    assertTrue(ok[0]);
    assertNull(interactor.getCommand());
}
Also used : WidgetBinding(org.malai.binding.WidgetBinding) InteractionMock(org.malai.interaction.InteractionMock) WidgetBindingImpl(org.malai.binding.WidgetBindingImpl) Command(org.malai.command.Command) Test(org.junit.jupiter.api.Test)

Example 2 with WidgetBinding

use of org.malai.binding.WidgetBinding in project Malai by arnobl.

the class TestInteractor method testInteractionStartsOkCauseOfTheNonPublicAction2.

@Test
void testInteractionStartsOkCauseOfTheNonPublicAction2() throws CancelFSMException {
    final boolean[] ok = { false };
    ErrorCatcher.INSTANCE.setNotifier(exception -> ok[0] = true);
    StubInstrument ins = new StubInstrument();
    WidgetBinding interactor2 = new WidgetBindingImpl<CommandImplStub3, InteractionMock, StubInstrument>(ins, false, CommandImplStub3.class, new InteractionMock()) {

        @Override
        public void first() {
        }

        @Override
        public boolean when() {
            return true;
        }

        @Override
        protected void executeCmdAsync(final Command cmd) {
        }
    };
    ins.setActivated(true);
    interactor2.fsmStarts();
    assertTrue(ok[0]);
    assertNull(interactor2.getCommand());
}
Also used : WidgetBinding(org.malai.binding.WidgetBinding) InteractionMock(org.malai.interaction.InteractionMock) WidgetBindingImpl(org.malai.binding.WidgetBindingImpl) Command(org.malai.command.Command) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 WidgetBinding (org.malai.binding.WidgetBinding)2 WidgetBindingImpl (org.malai.binding.WidgetBindingImpl)2 Command (org.malai.command.Command)2 InteractionMock (org.malai.interaction.InteractionMock)2