use of org.apache.cayenne.LifecycleListener in project cayenne by apache.
the class LifecycleCallbackRegistryTest method addDefaultListenerSingleType.
@Test
public void addDefaultListenerSingleType() throws Exception {
for (LifecycleEvent event : LifecycleEvent.values()) {
assertEquals(0, registry.getHandler(event).defaultListenersSize());
LifecycleListener listener = mock(LifecycleListener.class);
registry.addDefaultListener(event, listener, nameToCamelCase(event.name()));
assertEquals(1, registry.getHandler(event).defaultListenersSize());
assertEquals(0, registry.getHandler(event).listenersSize());
}
}
use of org.apache.cayenne.LifecycleListener in project cayenne by apache.
the class LifecycleCallbackRegistryTest method addListenerWithEntityClass.
@Test
public void addListenerWithEntityClass() throws Exception {
LifecycleListener listener = mock(LifecycleListener.class);
registry.addListener(Object.class, listener);
for (LifecycleEvent event : LifecycleEvent.values()) {
assertEquals(1, registry.getHandler(event).listenersSize());
assertEquals(0, registry.getHandler(event).defaultListenersSize());
}
}
use of org.apache.cayenne.LifecycleListener in project cayenne by apache.
the class LifecycleCallbackRegistryTest method addListenerWithEntityClassSingleType.
@Test
public void addListenerWithEntityClassSingleType() throws Exception {
for (LifecycleEvent event : LifecycleEvent.values()) {
assertEquals(0, registry.getHandler(event).listenersSize());
LifecycleListener listener = mock(LifecycleListener.class);
registry.addListener(event, Object.class, listener, nameToCamelCase(event.name()));
assertEquals(1, registry.getHandler(event).listenersSize());
assertEquals(0, registry.getHandler(event).defaultListenersSize());
}
}
use of org.apache.cayenne.LifecycleListener 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());
}
}
Aggregations