Search in sources :

Example 6 with InjectedElement

use of com.mvp4g.rebind.config.element.InjectedElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testInjectedServiceValidationSucceeds.

@Test
public void testInjectedServiceValidationSucceeds() throws UnknownConfigurationElementException {
    services.add(newService("testService"));
    PresenterElement presenter = newPresenter(SimplePresenter01.class, "testPresenter");
    presenter.getInjectedServices().add(new InjectedElement("testService", "setTestService"));
    presenters.add(presenter);
    HistoryConverterElement historyConverter = newHistoryConverter(SimpleHistoryConverter01.class, "testHistoryConverter");
    historyConverter.getInjectedServices().add(new InjectedElement("testService", "setTestService"));
    historyConverters.add(historyConverter);
    configuration.validateServices();
}
Also used : HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) InjectedElement(com.mvp4g.rebind.config.element.InjectedElement) PresenterElement(com.mvp4g.rebind.config.element.PresenterElement) Test(org.junit.Test)

Example 7 with InjectedElement

use of com.mvp4g.rebind.config.element.InjectedElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testInjectedServiceValidationFailsForHistoryConverter.

@Test(expected = UnknownConfigurationElementException.class)
public void testInjectedServiceValidationFailsForHistoryConverter() 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"));
    HistoryConverterElement historyConverter = newHistoryConverter(SimpleHistoryConverter02.class, "testHistoryConverter");
    historyConverter.getInjectedServices().add(new InjectedElement("badService", "setBadService"));
    historyConverters.add(historyConverter);
    configuration.validateServices();
}
Also used : SimpleView02(com.mvp4g.rebind.test_tools.annotation.views.SimpleView02) HistoryConverterElement(com.mvp4g.rebind.config.element.HistoryConverterElement) InjectedElement(com.mvp4g.rebind.config.element.InjectedElement) SimpleHistoryConverter01(com.mvp4g.rebind.test_tools.annotation.history_converters.SimpleHistoryConverter01) SimplePresenter01(com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01) Test(org.junit.Test)

Aggregations

InjectedElement (com.mvp4g.rebind.config.element.InjectedElement)7 Test (org.junit.Test)6 HistoryConverterElement (com.mvp4g.rebind.config.element.HistoryConverterElement)3 Mvp4gWithServicesElement (com.mvp4g.rebind.config.element.Mvp4gWithServicesElement)3 PresenterElement (com.mvp4g.rebind.config.element.PresenterElement)3 JClassType (com.google.gwt.core.ext.typeinfo.JClassType)2 ServiceElement (com.mvp4g.rebind.config.element.ServiceElement)2 SimpleHistoryConverter01 (com.mvp4g.rebind.test_tools.annotation.history_converters.SimpleHistoryConverter01)2 SimplePresenter01 (com.mvp4g.rebind.test_tools.annotation.presenters.SimplePresenter01)2 SimpleView02 (com.mvp4g.rebind.test_tools.annotation.views.SimpleView02)2 ArrayList (java.util.ArrayList)2 JMethod (com.google.gwt.core.ext.typeinfo.JMethod)1 JParameter (com.google.gwt.core.ext.typeinfo.JParameter)1 InjectService (com.mvp4g.client.annotation.InjectService)1 EventHandlerElement (com.mvp4g.rebind.config.element.EventHandlerElement)1 Mvp4gAnnotationException (com.mvp4g.rebind.exception.loader.Mvp4gAnnotationException)1