use of com.mvp4g.rebind.config.element.PresenterElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testEventHandlerWrongInterface.
@Test(expected = InvalidClassException.class)
public void testEventHandlerWrongInterface() throws InvalidMvp4gConfigurationException {
ViewElement view = newView(SimpleView02.class, "view");
views.add(view);
PresenterElement presenter = new PresenterElement();
presenter.setName("testHandler");
presenter.setView("view");
presenter.setClassName(Object.class.getName());
presenters.add(presenter);
EventElement event = newEvent("testEvent");
event.setHandlers(new String[] { "testHandler" });
events.add(event);
setEventBus();
configuration.validateEventHandlers();
}
use of com.mvp4g.rebind.config.element.PresenterElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testEventHandlerViewMissing.
@Test(expected = UnknownConfigurationElementException.class)
public void testEventHandlerViewMissing() throws InvalidMvp4gConfigurationException {
PresenterElement presenter = newPresenter(SimplePresenter01.class, "testHandler");
presenter.setView("view");
presenters.add(presenter);
EventElement event = newEvent("testEvent");
event.setHandlers(new String[] { "testHandler" });
events.add(event);
setEventBus();
configuration.validateEventHandlers();
}
use of com.mvp4g.rebind.config.element.PresenterElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testGenerateNotMultiple.
@Test
public void testGenerateNotMultiple() throws InvalidMvp4gConfigurationException {
EventBusElement eventBus = new EventBusElement(EventBusWithLookup.class.getName(), BaseEventBus.class.getName(), false);
configuration.setEventBus(eventBus);
EventElement event1 = newEvent("event1");
event1.setHandlers(new String[] { "generate2" });
event1.setGenerate(new String[] { "generate1", "generate2" });
events.add(event1);
ViewElement view = newView(SimpleView02.class, "view");
view.setClassName(SimpleView02.class.getCanonicalName());
views.add(view);
PresenterElement generate1 = newPresenter(SimplePresenter01.class, "generate1");
generate1.setView("view");
EventHandlerElement generate2 = newEventHandler(SimpleEventHandler01.class, "generate2");
presenters.add(generate1);
try {
configuration.validateEventHandlers();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertTrue(e.getMessage().contains("Event event1: you can generate only multiple handlers. Did you forget to set the attribute multiple to true for generate1?"));
}
presenters.clear();
eventHandlers.clear();
eventHandlers.add(generate2);
try {
configuration.validateEventHandlers();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertTrue(e.getMessage().contains("Event event1: you can generate only multiple handlers. Did you forget to set the attribute multiple to true for generate2?"));
}
}
use of com.mvp4g.rebind.config.element.PresenterElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testViewValidationSucceeds.
@Test
public void testViewValidationSucceeds() throws UnknownConfigurationElementException, InvalidTypeException, InvalidClassException, NotFoundClassException {
views.add(newView(SimpleView02.class, "testView"));
PresenterElement presenter = newPresenter(SimplePresenter01.class, "testPresenter");
presenter.setView("testView");
presenters.add(presenter);
configuration.validateViews();
}
use of com.mvp4g.rebind.config.element.PresenterElement 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();
}
Aggregations