Search in sources :

Example 1 with SimplePresenter01

use of com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01 in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testEventHistoryConverterFails.

@Test(expected = UnknownConfigurationElementException.class)
public void testEventHistoryConverterFails() throws InvalidMvp4gConfigurationException {
    events.add(newEvent("badHistoryConverter"));
    services.add(newService("badHistoryConverter"));
    presenters.add(newPresenter(SimplePresenter01.class, "badHistoryConverter"));
    views.add(newView(SimpleView02.class, "badHistoryConverter"));
    EventElement event = newEvent("testEvent");
    event.setHistory("badView");
    events.add(event);
    setEventBus();
    configuration.validateHistoryConverters();
}
Also used : SimpleView02(com.mvp4g.rebind.test_tools.annotation.views.SimpleView02) EventElement(com.mvp4g.rebind.config.element.EventElement) SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Test(org.junit.Test)

Example 2 with SimplePresenter01

use of com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01 in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testPresenterViewValidationFails.

@Test(expected = UnknownConfigurationElementException.class)
public void testPresenterViewValidationFails() throws UnknownConfigurationElementException, InvalidTypeException, InvalidClassException, NotFoundClassException {
    events.add(newEvent("badView"));
    services.add(newService("badView"));
    presenters.add(newPresenter(SimplePresenter01.class, "badView"));
    historyConverters.add(newHistoryConverter(SimpleHistoryConverter01.class, "badView"));
    PresenterElement presenter = newPresenter(SimplePresenter02.class, "testPresenter");
    presenter.setView("badView");
    presenters.add(presenter);
    configuration.validateViews();
}
Also used : SimpleHistoryConverter01(com.mvp4g.rebind.test_tools.annotation.history_converters.SimpleHistoryConverter01) PresenterElement(com.mvp4g.rebind.config.element.PresenterElement) SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Test(org.junit.Test)

Example 3 with SimplePresenter01

use of com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01 in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testInjectedServiceValidationFailsForPresenter.

@Test(expected = UnknownConfigurationElementException.class)
public void testInjectedServiceValidationFailsForPresenter() throws UnknownConfigurationElementException, InvalidTypeException, InvalidClassException, NotFoundClassException {
    events.add(newEvent("badService"));
    views.add(newView(SimpleView02.class, "badService"));
    presenters.add(newPresenter(SimplePresenter01.class, "badService"));
    historyConverters.add(newHistoryConverter(SimpleHistoryConverter01.class, "badService"));
    PresenterElement presenter = newPresenter(SimplePresenter02.class, "testPresenter");
    presenter.getInjectedServices().add(new InjectedElement("badService", "setBadService"));
    presenters.add(presenter);
    configuration.validateServices();
}
Also used : SimpleView02(com.mvp4g.rebind.test_tools.annotation.views.SimpleView02) InjectedElement(com.mvp4g.rebind.config.element.InjectedElement) SimpleHistoryConverter01(com.mvp4g.rebind.test_tools.annotation.history_converters.SimpleHistoryConverter01) PresenterElement(com.mvp4g.rebind.config.element.PresenterElement) SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Test(org.junit.Test)

Example 4 with SimplePresenter01

use of com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01 in project mvp4g by mvp4g.

the class BaseEventBusTest method testDefaultAddHandler.

@Test
public void testDefaultAddHandler() {
    List<SimplePresenter01> list = bus.getHandlers(SimplePresenter01.class);
    SimplePresenter01 p = bus.addHandler(SimplePresenter01.class);
    list = bus.getHandlers(SimplePresenter01.class);
    assertTrue(list.size() == 1);
    assertEquals(list.get(0), p);
    assertTrue(p.isBindCalled());
    p = bus.addHandler(SimplePresenter01.class, true);
    list = bus.getHandlers(SimplePresenter01.class);
    assertTrue(list.size() == 2);
    assertEquals(list.get(1), p);
    assertTrue(p.isBindCalled());
    p = bus.addHandler(SimplePresenter01.class, false);
    list = bus.getHandlers(SimplePresenter01.class);
    assertTrue(list.size() == 3);
    assertEquals(list.get(2), p);
    assertFalse(p.isBindCalled());
}
Also used : SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Test(org.junit.Test)

Example 5 with SimplePresenter01

use of com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01 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

SimplePresenter01 (com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01)18 Test (org.junit.Test)16 JClassType (com.google.gwt.core.ext.typeinfo.JClassType)8 Events (com.mvp4g.rebind.test_tools.annotation.Events)5 SimpleView02 (com.mvp4g.rebind.test_tools.annotation.views.SimpleView02)4 PresenterElement (com.mvp4g.rebind.config.element.PresenterElement)3 SimpleHistoryConverter01 (com.mvp4g.rebind.test_tools.annotation.history_converters.SimpleHistoryConverter01)3 TypeOracleStub (com.google.gwt.dev.javac.typemodel.TypeOracleStub)2 EventElement (com.mvp4g.rebind.config.element.EventElement)2 InjectedElement (com.mvp4g.rebind.config.element.InjectedElement)2 Mvp4gAnnotationException (com.mvp4g.rebind.exception.loader.Mvp4gAnnotationException)2 HistoryConverterForEvent (com.mvp4g.rebind.test_tools.annotation.history_converters.HistoryConverterForEvent)2 PresenterWithName (com.mvp4g.rebind.test_tools.annotation.presenters.PresenterWithName)2 Before (org.junit.Before)2 TreeLogger (com.google.gwt.core.ext.TreeLogger)1 UnitTestTreeLogger (com.google.gwt.dev.util.UnitTestTreeLogger)1 DefaultMvp4gGinModule (com.mvp4g.client.DefaultMvp4gGinModule)1 Mvp4gModule (com.mvp4g.client.Mvp4gModule)1 BaseEventBus (com.mvp4g.client.event.BaseEventBus)1 BaseEventBusWithLookUp (com.mvp4g.client.event.BaseEventBusWithLookUp)1