use of com.mvp4g.rebind.config.element.PresenterElement in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testActivateDeActivateUseless.
@Test
public void testActivateDeActivateUseless() throws InvalidMvp4gConfigurationException {
EventBusElement eventBus = new EventBusElement(EventBusWithLookup.class.getName(), BaseEventBus.class.getName(), false);
configuration.setEventBus(eventBus);
EventElement event1 = newEvent("event1");
event1.setActivate(new String[] { "activate1", "activate2" });
event1.setDeactivate(new String[] { "deactivate1", "deactivate2" });
events.add(event1);
PresenterElement activate1 = newPresenter(SimplePresenter01.class, "activate1");
EventHandlerElement activate2 = newEventHandler(SimpleEventHandler01.class, "activate2");
PresenterElement deactivate1 = newPresenter(SimplePresenter02.class, "deactivate1");
EventHandlerElement deactivate2 = newEventHandler(SimpleEventHandler02.class, "deactivate2");
eventHandlers.add(activate1);
eventHandlers.add(activate2);
eventHandlers.add(deactivate1);
eventHandlers.add(deactivate2);
configuration.validateEventHandlers();
List<String> activate = event1.getActivate();
assertTrue(activate.size() == 0);
List<String> deactivate = event1.getDeactivate();
assertTrue(deactivate.size() == 0);
}
use of com.mvp4g.rebind.config.element.PresenterElement in project mvp4g by mvp4g.
the class PresenterAnnotationsLoader method loadHandler.
@Override
protected PresenterElement loadHandler(JClassType c, Presenter annotation, Mvp4gConfiguration configuration) throws Mvp4gAnnotationException {
String className = c.getQualifiedSourceName();
String viewName = buildElementNameIfNeeded(annotation.viewName(), className, "View");
PresenterElement presenter = new PresenterElement();
presenter.setView(viewName);
ViewElement view = new ViewElement();
view.setClassName(annotation.view().getCanonicalName());
view.setName(viewName);
addElement(configuration.getViews(), view, c, null);
return presenter;
}
use of com.mvp4g.rebind.config.element.PresenterElement in project mvp4g by mvp4g.
the class TestExceptions method testInvalidTypeException.
@Test
public void testInvalidTypeException() {
PresenterElement p = new PresenterElement();
p.setName("name");
p.setClassName("com.test.Presenter");
InvalidTypeException e = new InvalidTypeException(p, "Event Bus", EventBus.class.getName(), EventBusWithLookup.class.getName());
assertEquals("presenter name: Invalid Event Bus. Can not convert " + EventBus.class.getName() + " to " + EventBusWithLookup.class.getName(), e.getMessage());
}
use of com.mvp4g.rebind.config.element.PresenterElement in project mvp4g by mvp4g.
the class TestExceptions method testNotFoundClassException.
@Test
public void testNotFoundClassException() {
PresenterElement p = new PresenterElement();
p.setName("name");
p.setClassName("com.test.Presenter");
NotFoundClassException e = new NotFoundClassException(null, PresenterInterface.class.getName());
assertEquals("No source code is available for " + PresenterInterface.class.getName(), e.getMessage());
e = new NotFoundClassException(p, PresenterInterface.class.getName());
assertEquals("presenter name: No source code is available for " + PresenterInterface.class.getName(), e.getMessage());
}
Aggregations