@Test
public void testAddListeners() throws RepositoryException {

    EventListenerDefinition def1 = new EventListenerDefinition();
    EventListenerDefinition def2 = new EventListenerDefinition();
    EventListenerDefinition listeners[] = new EventListenerDefinition[] { def1, def2 };
    factory.setEventListeners(listeners);
    Session session = createMock(Session.class);
    Workspace workspace = createMock(Workspace.class);
    ObservationManager observationManager = createMock(ObservationManager.class);
    expect(repository.login(null, null)).andReturn(session);
    expect(session.getWorkspace()).andReturn(workspace);
    expect(workspace.getObservationManager()).andReturn(observationManager);
    observationManager.addEventListener(def1.getListener(), def1.getEventTypes(), def1.getAbsPath(), def1.isDeep(),
            def1.getUuid(), def1.getNodeTypeName(), def1.isNoLocal());
    observationManager.addEventListener(def2.getListener(), def2.getEventTypes(), def2.getAbsPath(), def2.isDeep(),
            def2.getUuid(), def2.getNodeTypeName(), def2.isNoLocal());
    replay(repository, session, workspace, observationManager);
    // coverage madness
    assertSame(listeners, factory.getEventListeners());
    Session sess = factory.getSession();
    assertSame(session, sess);
    verify(repository, session, workspace, observationManager);
}