Search in sources :

Example 1 with EventFilterStub

use of com.mvp4g.client.test_tools.EventFilterStub in project mvp4g by mvp4g.

the class BaseEventBusTest method testMultipleFilters.

@Test
public void testMultipleFilters() {
    assertTrue(bus.filterEvent("test"));
    EventFilterStub filter1 = new EventFilterStub();
    EventFilterStub filter2 = new EventFilterStub();
    bus.addEventFilter(filter1);
    bus.addEventFilter(filter2);
    filter1.setFilter(true);
    filter2.setFilter(true);
    assertTrue(bus.filterEvent("test"));
    filter1.setFilter(true);
    filter2.setFilter(false);
    assertFalse(bus.filterEvent("test"));
    filter1.setFilter(false);
    filter2.setFilter(true);
    assertFalse(bus.filterEvent("test"));
    filter1.setFilter(false);
    filter2.setFilter(false);
    assertFalse(bus.filterEvent("test"));
}
Also used : EventFilterStub(com.mvp4g.client.test_tools.EventFilterStub) Test(org.junit.Test)

Example 2 with EventFilterStub

use of com.mvp4g.client.test_tools.EventFilterStub in project mvp4g by mvp4g.

the class BaseEventBusTest method setUp.

@Before
public void setUp() {
    bus = new BaseEventBus() {

        @SuppressWarnings("unchecked")
        @Override
        protected <T extends EventHandlerInterface<?>> T createHandler(Class<T> handlerClass) {
            return (T) ((SimplePresenter01.class.equals(handlerClass)) ? new SimplePresenter01() : null);
        }

        public void setApplicationHistoryStored(boolean historyStored) {
        }

        public void setNavigationConfirmation(NavigationConfirmationInterface navigationConfirmation) {
        }

        public void confirmNavigation(NavigationEventCommand event) {
        }
    };
    module = new Mvp4gModuleStub(bus);
    filter = new EventFilterStub();
}
Also used : NavigationEventCommand(com.mvp4g.client.history.NavigationEventCommand) EventFilterStub(com.mvp4g.client.test_tools.EventFilterStub) NavigationConfirmationInterface(com.mvp4g.client.history.NavigationConfirmationInterface) Mvp4gModuleStub(com.mvp4g.client.test_tools.Mvp4gModuleStub) SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Before(org.junit.Before)

Aggregations

EventFilterStub (com.mvp4g.client.test_tools.EventFilterStub)2 NavigationConfirmationInterface (com.mvp4g.client.history.NavigationConfirmationInterface)1 NavigationEventCommand (com.mvp4g.client.history.NavigationEventCommand)1 Mvp4gModuleStub (com.mvp4g.client.test_tools.Mvp4gModuleStub)1 SimplePresenter01 (com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01)1 Before (org.junit.Before)1 Test (org.junit.Test)1