Search in sources :

Example 1 with EventFilterElement

use of com.mvp4g.rebind.config.element.EventFilterElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testEventFiltersWrongEventBus.

@Test
public void testEventFiltersWrongEventBus() throws InvalidMvp4gConfigurationException {
    EventBusElement eventBus = new EventBusElement(EventBus.class.getName(), BaseEventBus.class.getName(), false);
    configuration.setEventBus(eventBus);
    EventFilterElement filter = new EventFilterElement();
    oracle.addClass(EventFilters.EventFilter3.class);
    filter.setClassName(EventFilters.EventFilter3.class.getCanonicalName());
    eventFilters.add(filter);
    try {
        configuration.validateEventFilters();
        fail();
    } catch (InvalidTypeException e) {
        assertTrue(e.getMessage().contains("Can not convert " + EventBus.class.getCanonicalName()));
    }
}
Also used : EventBusElement(com.mvp4g.rebind.config.element.EventBusElement) BaseEventBus(com.mvp4g.client.event.BaseEventBus) EventBus(com.mvp4g.client.event.EventBus) BaseEventBus(com.mvp4g.client.event.BaseEventBus) EventFilterElement(com.mvp4g.rebind.config.element.EventFilterElement) EventFilters(com.mvp4g.rebind.test_tools.annotation.EventFilters) InvalidTypeException(com.mvp4g.rebind.exception.InvalidTypeException) Test(org.junit.Test)

Example 2 with EventFilterElement

use of com.mvp4g.rebind.config.element.EventFilterElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method testEventFiltersWrongClass.

@Test
public void testEventFiltersWrongClass() throws InvalidMvp4gConfigurationException {
    EventBusElement eventBus = new EventBusElement(EventBusWithLookup.class.getName(), BaseEventBus.class.getName(), false);
    configuration.setEventBus(eventBus);
    EventFilterElement filter = new EventFilterElement();
    filter.setClassName(Object.class.getName());
    eventFilters.add(filter);
    try {
        configuration.validateEventFilters();
        fail();
    } catch (InvalidClassException e) {
        assertTrue(e.getMessage().contains("This class must extend " + EventFilter.class.getCanonicalName()));
    }
}
Also used : InvalidClassException(com.mvp4g.rebind.exception.InvalidClassException) EventBusElement(com.mvp4g.rebind.config.element.EventBusElement) EventBusWithLookup(com.mvp4g.client.event.EventBusWithLookup) BaseEventBus(com.mvp4g.client.event.BaseEventBus) OneObject(com.mvp4g.rebind.test_tools.OneObject) EventFilterElement(com.mvp4g.rebind.config.element.EventFilterElement) Test(org.junit.Test)

Example 3 with EventFilterElement

use of com.mvp4g.rebind.config.element.EventFilterElement in project mvp4g by mvp4g.

the class Mvp4gConfigurationTest method newEventFilter.

private EventFilterElement newEventFilter(Class<? extends EventFilter<? extends EventBus>> c, String name) {
    EventFilterElement eventFilter = new EventFilterElement();
    eventFilter.setName(name);
    oracle.addClass(c);
    eventFilter.setClassName(c.getCanonicalName());
    return eventFilter;
}
Also used : EventFilterElement(com.mvp4g.rebind.config.element.EventFilterElement)

Aggregations

EventFilterElement (com.mvp4g.rebind.config.element.EventFilterElement)3 BaseEventBus (com.mvp4g.client.event.BaseEventBus)2 EventBusElement (com.mvp4g.rebind.config.element.EventBusElement)2 Test (org.junit.Test)2 EventBus (com.mvp4g.client.event.EventBus)1 EventBusWithLookup (com.mvp4g.client.event.EventBusWithLookup)1 InvalidClassException (com.mvp4g.rebind.exception.InvalidClassException)1 InvalidTypeException (com.mvp4g.rebind.exception.InvalidTypeException)1 OneObject (com.mvp4g.rebind.test_tools.OneObject)1 EventFilters (com.mvp4g.rebind.test_tools.annotation.EventFilters)1