Search in sources :

Example 6 with LifecycleEvent

use of org.apache.cayenne.map.LifecycleEvent in project cayenne by apache.

the class LifecycleCallbackRegistryTest method addAnnotatedListener.

@Test
public void addAnnotatedListener() {
    registry.addListener(new AnnotatedListener());
    for (LifecycleEvent event : LifecycleEvent.values()) {
        assertEquals(1, registry.getHandler(event).defaultListenersSize());
        assertEquals(0, registry.getHandler(event).listenersSize());
    }
}
Also used : LifecycleEvent(org.apache.cayenne.map.LifecycleEvent) Test(org.junit.Test)

Example 7 with LifecycleEvent

use of org.apache.cayenne.map.LifecycleEvent in project cayenne by apache.

the class LifecycleCallbackRegistryTest method addDefaultListener.

@Test
public void addDefaultListener() throws Exception {
    LifecycleListener listener = mock(LifecycleListener.class);
    registry.addDefaultListener(listener);
    for (LifecycleEvent event : LifecycleEvent.values()) {
        assertEquals(1, registry.getHandler(event).defaultListenersSize());
        assertEquals(0, registry.getHandler(event).listenersSize());
    }
}
Also used : LifecycleEvent(org.apache.cayenne.map.LifecycleEvent) LifecycleListener(org.apache.cayenne.LifecycleListener) Test(org.junit.Test)

Aggregations

LifecycleEvent (org.apache.cayenne.map.LifecycleEvent)7 Test (org.junit.Test)6 LifecycleListener (org.apache.cayenne.LifecycleListener)4 EntityResolver (org.apache.cayenne.map.EntityResolver)1 Before (org.junit.Before)1