Search in sources :

Example 1 with Mvp4gModuleStub

use of com.mvp4g.client.test_tools.Mvp4gModuleStub 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)

Example 2 with Mvp4gModuleStub

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

the class PlaceServiceTest method testConverterForChildModuleNoParameter.

@Test
public void testConverterForChildModuleNoParameter() {
    String historyName = "child/historyName";
    EventBusWithLookUpStub childBus = new EventBusWithLookUpStub();
    Mvp4gModuleStub childModule = new Mvp4gModuleStub(childBus);
    ValueChangeEvent<String> event = new ValueChangeEventStub<String>(historyName);
    placeServiceDefault.addConverter(historyName, buildHistoryConverter(false));
    placeServiceDefault.onValueChange(event);
    assertEquals(historyName, module.getEventType());
    Mvp4gEventPasser passer = module.getPasser();
    passer.setEventObject(false);
    passer.pass(childModule);
    assertTrue(module.isHistoryNotFound());
    passer.setEventObject(true);
    passer.pass(childModule);
    childBus.assertEvent("historyName", new Object[] { null });
}
Also used : ValueChangeEventStub(com.mvp4g.client.test_tools.ValueChangeEventStub) EventBusWithLookUpStub(com.mvp4g.client.test_tools.EventBusWithLookUpStub) Mvp4gEventPasser(com.mvp4g.client.Mvp4gEventPasser) Mvp4gModuleStub(com.mvp4g.client.test_tools.Mvp4gModuleStub) Test(org.junit.Test)

Example 3 with Mvp4gModuleStub

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

the class PlaceServiceTest method setUp.

@Before
public void setUp() {
    history = new HistoryProxyStub();
    historySeparator = new HistoryProxyStub();
    historySeparatorAdd = new HistoryProxyStub();
    eventBus = new EventBusWithLookUpStub();
    module = new Mvp4gModuleStub(eventBus);
    placeServiceDefault = new PlaceService(history);
    placeServiceDefault.setModule(module);
}
Also used : EventBusWithLookUpStub(com.mvp4g.client.test_tools.EventBusWithLookUpStub) HistoryProxyStub(com.mvp4g.client.test_tools.HistoryProxyStub) Mvp4gModuleStub(com.mvp4g.client.test_tools.Mvp4gModuleStub) Before(org.junit.Before)

Example 4 with Mvp4gModuleStub

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

the class PlaceServiceTest method testConverterForChildModuleNoConverter.

@Test
public void testConverterForChildModuleNoConverter() {
    String historyName = "child/historyName";
    EventBusWithLookUpStub childBus = new EventBusWithLookUpStub();
    Mvp4gModuleStub childModule = new Mvp4gModuleStub(childBus);
    ValueChangeEvent<String> event = new ValueChangeEventStub<String>(historyName);
    placeServiceDefault.onValueChange(event);
    assertEquals(historyName, module.getEventType());
    Mvp4gEventPasser passer = module.getPasser();
    passer.setEventObject(true);
    passer.pass(childModule);
    assertTrue(module.isHistoryNotFound());
}
Also used : ValueChangeEventStub(com.mvp4g.client.test_tools.ValueChangeEventStub) EventBusWithLookUpStub(com.mvp4g.client.test_tools.EventBusWithLookUpStub) Mvp4gEventPasser(com.mvp4g.client.Mvp4gEventPasser) Mvp4gModuleStub(com.mvp4g.client.test_tools.Mvp4gModuleStub) Test(org.junit.Test)

Example 5 with Mvp4gModuleStub

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

the class PlaceServiceTest method testConverterForChildModuleWithParameter.

@Test
public void testConverterForChildModuleWithParameter() {
    String historyName = "child/eventType";
    String form = "form";
    EventBusWithLookUpStub childBus = new EventBusWithLookUpStub();
    Mvp4gModuleStub childModule = new Mvp4gModuleStub(childBus);
    placeServiceDefault.addConverter(historyName, buildHistoryConverter(false));
    ValueChangeEvent<String> event = new ValueChangeEventStub<String>(historyName + "?" + form);
    placeServiceDefault.onValueChange(event);
    assertEquals(historyName, module.getEventType());
    Mvp4gEventPasser passer = module.getPasser();
    passer.setEventObject(true);
    passer.pass(childModule);
    childBus.assertEvent("eventType", new Object[] { form });
}
Also used : ValueChangeEventStub(com.mvp4g.client.test_tools.ValueChangeEventStub) EventBusWithLookUpStub(com.mvp4g.client.test_tools.EventBusWithLookUpStub) Mvp4gEventPasser(com.mvp4g.client.Mvp4gEventPasser) Mvp4gModuleStub(com.mvp4g.client.test_tools.Mvp4gModuleStub) Test(org.junit.Test)

Aggregations

Mvp4gModuleStub (com.mvp4g.client.test_tools.Mvp4gModuleStub)5 EventBusWithLookUpStub (com.mvp4g.client.test_tools.EventBusWithLookUpStub)4 Mvp4gEventPasser (com.mvp4g.client.Mvp4gEventPasser)3 ValueChangeEventStub (com.mvp4g.client.test_tools.ValueChangeEventStub)3 Test (org.junit.Test)3 Before (org.junit.Before)2 NavigationConfirmationInterface (com.mvp4g.client.history.NavigationConfirmationInterface)1 NavigationEventCommand (com.mvp4g.client.history.NavigationEventCommand)1 EventFilterStub (com.mvp4g.client.test_tools.EventFilterStub)1 HistoryProxyStub (com.mvp4g.client.test_tools.HistoryProxyStub)1 SimplePresenter01 (com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01)1