### Question:
DefaultEventManager implements EventManager { public void addListener( Object listener, String methodName, Class<?> eventParameterClass, EventSubject subject) { this.addListener(listener, methodName, eventParameterClass, subject, null, true); } DefaultEventManager();  DefaultEventManager(int dispatchThreadCount); boolean isStopped(); boolean isSingleThreaded(); @BeforeScopeEnd void shutdown(); void addListener(
            Object listener,
            String methodName,
            Class<?> eventParameterClass,
            EventSubject subject); void addNonBlockingListener(
            Object listener,
            String methodName,
            Class<?> eventParameterClass,
            EventSubject subject); void addListener(
            Object listener,
            String methodName,
            Class<?> eventParameterClass,
            EventSubject subject,
            Object sender); void addNonBlockingListener(
            Object listener,
            String methodName,
            Class<?> eventParameterClass,
            EventSubject subject,
            Object sender); boolean removeListener(Object listener); boolean removeAllListeners(EventSubject subject); boolean removeListener(Object listener, EventSubject subject); boolean removeListener(Object listener, EventSubject subject, Object sender); void postEvent(EventObject event, EventSubject subject); void postNonBlockingEvent(EventObject event, EventSubject subject);  }### Answer:
@Test public void testNullListener() { try { EventSubject subject = EventSubject.getSubject(this.getClass(), "hansi"); eventManager.addListener(null, null, null, subject); fail(); } catch (IllegalArgumentException ia) { } }
@Test public void testNullNotification() { try { eventManager.addListener(this, "testNullObserver", CayenneEvent.class, null); fail(); } catch (IllegalArgumentException e) { } try { EventSubject subject = EventSubject.getSubject(this.getClass(), ""); eventManager.addListener(this, "testNullObserver", null, subject); fail(); } catch (IllegalArgumentException e) { } try { EventSubject subject = EventSubject.getSubject(this.getClass(), ""); eventManager.addListener( this, "testNullObserver", CayenneEvent.class, subject); fail(); } catch (IllegalArgumentException e) { } }
@Test public void testNonexistingMethod() { try { EventSubject subject = EventSubject.getSubject(this.getClass(), "hansi"); eventManager.addListener( this, "thisMethodDoesNotExist", CayenneEvent.class, subject); fail(); } catch (RuntimeException e) { } }
@Test public void testInvalidArgumentTypes() { try { EventSubject subject = EventSubject.getSubject(this.getClass(), "hansi"); eventManager.addListener( this, "seeTheWrongMethod", CayenneEvent.class, subject); fail(); } catch (RuntimeException e) { } }