use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testAutoDisplay.
@Test
public void testAutoDisplay() throws InvalidMvp4gConfigurationException {
ChildModuleElement childModule1 = newChildModule(Modules.ChildModule01.class, "child1");
childModules.add(childModule1);
assertTrue(childModule1.isAutoDisplay());
EventElement event = newEvent("testEvent");
event.setForwardToModules(new String[] { "child1" });
event.setEventObjectClass(new String[] { Object.class.getCanonicalName() });
events.add(event);
setEventBus();
configuration.setModule(oracle.addClass(Modules.ModuleWithParent01.class));
try {
configuration.validateChildModules();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertEquals(e.getMessage(), String.format("%s: child module %s doesn't define any event to load its view.", Modules.ModuleWithParent01.class.getCanonicalName(), childModule1.getClassName()));
}
childModule1.setAutoDisplay("false");
configuration.validateChildModules();
}
use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method validateHistoryName.
@Test
public void validateHistoryName() throws InvalidMvp4gConfigurationException {
EventElement element = newEvent("forward");
try {
configuration.validateHistoryName("!test", element);
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertTrue(e.getMessage().contains("history name can't start with '" + PlaceService.CRAWLABLE + "' or contain '" + PlaceService.MODULE_SEPARATOR + "'."));
}
try {
configuration.validateHistoryName("/test", element);
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertTrue(e.getMessage().contains("history name can't start with '" + PlaceService.CRAWLABLE + "' or contain '" + PlaceService.MODULE_SEPARATOR + "'."));
}
try {
configuration.validateHistoryName("te/st", element);
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertTrue(e.getMessage().contains("history name can't start with '" + PlaceService.CRAWLABLE + "' or contain '" + PlaceService.MODULE_SEPARATOR + "'."));
}
configuration.validateHistoryName("test", element);
configuration.validateHistoryName("tes!t", element);
}
use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testEventWithNoObjectForAutoDisplay.
@Test(expected = InvalidMvp4gConfigurationException.class)
public void testEventWithNoObjectForAutoDisplay() throws InvalidMvp4gConfigurationException {
ChildModuleElement childModule1 = newChildModule(Modules.ChildModule01.class, "child1");
childModule1.setEventToDisplayView("testEvent");
childModules.add(childModule1);
EventElement event = newEvent("testEvent");
event.setForwardToModules(new String[] { "child1" });
events.add(event);
setEventBus();
try {
configuration.validateChildModules();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertEquals("Event testEvent: event must have one and only one an object associated with it as it loads a child view.", e.getMessage());
throw e;
}
}
use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testForwardEventRootModule.
@Test
public void testForwardEventRootModule() throws InvalidMvp4gConfigurationException {
StartElement start = configuration.getStart();
start.setForwardEventType("forward");
try {
configuration.validateEvents();
fail();
} catch (InvalidMvp4gConfigurationException ex) {
assertEquals("You can't define a forward event for RootModule since no event from parent can be forwarded to it.", ex.getMessage());
}
}
use of com.mvp4g.rebind.exception.InvalidMvp4gConfigurationException in project mvp4g by mvp4g.
the class Mvp4gConfigurationTest method testTokenGenerationNotOk.
@Test
public void testTokenGenerationNotOk() {
EventElement event = new EventElement();
event.setWithTokenGeneration("true");
event.setType("event1");
events.add(event);
try {
configuration.validateHistoryConverters();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertEquals("Event event1: you can't generate a token for this event if it has no history converter.", e.getMessage());
}
configuration.setModule(oracle.addClass(Modules.Module01.class));
try {
configuration.validateHistoryConverters();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertEquals("Event event1: you can't generate a token for this event if it has no history converter.", e.getMessage());
}
configuration.setParentEventBus(oracle.addClass(EventBusOk.class));
try {
configuration.validateHistoryConverters();
fail();
} catch (InvalidMvp4gConfigurationException e) {
assertEquals("Event event1: you can't generate a token for this event if it has no history converter.", e.getMessage());
}
}
Aggregations