use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testSameActivateDeactivate.
@Test
public void testSameActivateDeactivate() {
EventBusElement eventBus = new EventBusElement(EventBusWithLookup.class.getName(), BaseEventBus.class.getName(), false);
configuration.setEventBus(eventBus);
EventElement event1 = newEvent("event1");
event1.setActivate(new String[] { "activate" });
event1.setDeactivate(new String[] { "activate" });
events.add(event1);
try {
configuration.validateEventHandlers();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertTrue(e.getMessage().contains("an event can't activate and deactivate the same handler: activate."));
}
}
use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testValidateSplitterStartPresenter.
@Test
public void testValidateSplitterStartPresenter() {
setEventBus();
PresenterElement presenter = newPresenter(SimplePresenter01.class, "presenter");
configuration.getStart().setPresenter("presenter");
presenter.setAsync("true");
presenters.add(presenter);
EventElement event = new EventElement();
event.setType("event");
event.setHandlers(new String[] { "presenter" });
events.add(event);
try {
configuration.validateSplitters();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertEquals("Presenter presenter: start presenter can't be loaded asynchronously. Async attribute must not be set.", e.getMessage());
}
}
use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testHistoryNameNoConveter.
@Test
public void testHistoryNameNoConveter() {
EventElement e = newEvent("start");
e.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
e.setName("name");
events.add(e);
try {
configuration.validateHistoryConverters();
fail();
} catch (InvalidMvp4gConfigurationException ex) {
assertEquals("Event start: you defined an history name for this event but this event has no history converter.", ex.getMessage());
}
}
use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testFindChildModuleSameHistory.
@Test(expected = InvalidMvp4gConfigurationException.class)
public void testFindChildModuleSameHistory() throws InvalidMvp4gConfigurationException {
setEventBus();
ChildModuleElement childModule1 = newChildModule(Modules.ModuleWithParent01.class, "child1");
childModules.add(childModule1);
ChildModuleElement childModule2 = new ChildModuleElement();
childModule2.setName("child2");
childModule2.setClassName(Modules.ModuleWithParent01.class.getCanonicalName());
childModules.add(childModule2);
JClassType module = oracle.findType(Mvp4gModule.class.getCanonicalName());
configuration.setModule(module);
try {
configuration.findChildModuleHistoryNameAndLoader();
fail();
} catch (InvalidMvp4gConfigurationException e) {
String.format("Module %s: You can't have two child modules with the same history name \"%s\".", module.getQualifiedSourceName(), "moduleWithParent");
throw e;
}
}
use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testChildModulesNoStart.
@Test(expected = InvalidMvp4gConfigurationException.class)
public void testChildModulesNoStart() throws InvalidMvp4gConfigurationException {
ChildModuleElement childModule1 = newChildModule(Modules.ChildModule01.class, "child1");
childModule1.setEventToDisplayView("testEvent");
childModules.add(childModule1);
configuration.getOthersEventBusClassMap().put(Modules.ChildModule01.class.getCanonicalName(), oracle.addClass(EventBusWithNoStartPresenter.class));
EventElement event = newEvent("testEvent");
event.setForwardToModules(new String[] { "child1" });
event.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
events.add(event);
try {
configuration.validateChildModules();
} catch (InvalidMvp4gConfigurationException e) {
assertEquals("Module com.mvp4g.rebind.test_tools.Modules.ChildModule01: You must define a start presenter since this module has a parent module that uses the auto-displayed feature for this module.", e.getMessage());
throw e;
}
}
Aggregations