Search in sources :

Example 1 with UnknownConfigurationElementException

use of com.mvp4g.rebind.exception.UnknownConfigurationElementException in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testUnknownLoadConfigEvent.

@Test
public void testUnknownLoadConfigEvent() throws InvalidMvp4gConfigurationException {
    ChildModulesElement childModules = new ChildModulesElement();
    configuration.setHistory(null);
    configuration.setLoadChildConfig(childModules);
    childModules.setBeforeEvent("unknown");
    try {
        configuration.validateEvents();
        fail();
    } catch (UnknownConfigurationElementException e) {
    // nothing to test
    }
    childModules = new ChildModulesElement();
    configuration.setLoadChildConfig(childModules);
    childModules.setAfterEvent("unknown");
    try {
        configuration.validateEvents();
        fail();
    } catch (UnknownConfigurationElementException e) {
    // nothing to test
    }
    childModules = new ChildModulesElement();
    configuration.setLoadChildConfig(childModules);
    childModules.setErrorEvent("unknown");
    try {
        configuration.validateEvents();
        fail();
    } catch (UnknownConfigurationElementException e) {
    // nothing to test
    }
}
Also used : ChildModulesElement(com.mvp4g.rebind.config.element.ChildModulesElement) UnknownConfigurationElementException(com.mvp4g.rebind.exception.UnknownConfigurationElementException) Test(org.junit.Test)

Example 2 with UnknownConfigurationElementException

use of com.mvp4g.rebind.exception.UnknownConfigurationElementException in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testUnknownActivateDeactivate.

@Test
public void testUnknownActivateDeactivate() throws InvalidMvp4gConfigurationException {
    EventBusElement eventBus = new EventBusElement(EventBusWithLookup.class.getName(), BaseEventBus.class.getName(), false);
    configuration.setEventBus(eventBus);
    EventElement event1 = newEvent("event1");
    event1.setActivate(new String[] { "activate" });
    events.add(event1);
    try {
        configuration.validateEventHandlers();
        fail();
    } catch (UnknownConfigurationElementException e) {
        assertTrue(e.getMessage().contains("Encountered a reference to unknown element 'activate'"));
    }
    events.clear();
    EventElement event2 = newEvent("event2");
    event2.setDeactivate(new String[] { "deactivate" });
    events.add(event2);
    try {
        configuration.validateEventHandlers();
        fail();
    } catch (UnknownConfigurationElementException e) {
        assertTrue(e.getMessage().contains("Encountered a reference to unknown element 'deactivate'"));
    }
}
Also used : EventElement(com.mvp4g.rebind.config.element.EventElement) EventBusElement(com.mvp4g.rebind.config.element.EventBusElement) EventBusWithLookup(com.mvp4g.client.event.EventBusWithLookup) BaseEventBus(com.mvp4g.client.event.BaseEventBus) UnknownConfigurationElementException(com.mvp4g.rebind.exception.UnknownConfigurationElementException) Test(org.junit.Test)

Aggregations

UnknownConfigurationElementException (com.mvp4g.rebind.exception.UnknownConfigurationElementException)2 Test (org.junit.Test)2 BaseEventBus (com.mvp4g.client.event.BaseEventBus)1 EventBusWithLookup (com.mvp4g.client.event.EventBusWithLookup)1 ChildModulesElement (com.mvp4g.rebind.config.element.ChildModulesElement)1 EventBusElement (com.mvp4g.rebind.config.element.EventBusElement)1 EventElement (com.mvp4g.rebind.config.element.EventElement)1