### Question:
JcrObservationManager implements ObservationManager { public EventListenerIterator getRegisteredEventListeners() throws RepositoryException { checkSession(); return new JcrEventListenerIterator(this.listeners.keySet()); } JcrObservationManager( JcrSession session,
                           Observable repositoryObservable ); synchronized void addEventListener( EventListener listener,
                                               int eventTypes,
                                               String absPath,
                                               boolean isDeep,
                                               String[] uuid,
                                               String[] nodeTypeName,
                                               boolean noLocal ); EventListenerIterator getRegisteredEventListeners(); synchronized void removeEventListener( EventListener listener ); @Override void setUserData( String userData ); @Override EventJournal getEventJournal(); @Override EventJournal getEventJournal( int eventTypes,
                                         String absPath,
                                         boolean isDeep,
                                         String[] uuid,
                                         String[] nodeTypeName );  }### Answer:
@Test public void shouldTestGetRegisteredEventListenersTest_testRemoveEventListener() throws Exception { TestListener listener1 = addListener(0, ALL_EVENTS, null, false, null, null, false); EventListener listener2 = addListener(0, ALL_EVENTS, null, false, null, null, false); assertThat("Wrong number of event listeners.", getObservationManager().getRegisteredEventListeners().getSize(), is(2L)); removeListener(listener1); assertThat("Wrong number of event listeners after removing a listener.", getObservationManager().getRegisteredEventListeners().getSize(), is(1L)); assertThat("Wrong number of event listeners after removing a listener.", getObservationManager().getRegisteredEventListeners().nextEventListener(), is(listener2)); }