### Question:
MessageEventService { public final void addHandler( final Message eventType, final MessageEventHandler handler ) throws HandlerRegistrationException { if ( handler != null && eventType != null ) { addHandlerFor( eventType, handler ); } else { throw new HandlerRegistrationException( "One of the parameters is null : " + " eventType: " + eventType + " handler:" + handler ); } } MessageEventService(); void fireEvent( final Message event ); final void addHandler( final Message eventType, final MessageEventHandler handler ); final boolean hasHandlers( final Message eventType ); List<MessageEventHandler> getHandlersFor( final Message eventType );  }### Answer:
@Test( expected = HandlerRegistrationException.class ) public void testTranformationDuplicateAddHandler() throws KettleException { messageEventService.addHandler( transformationMessageEvent, messageEventHandler ); messageEventService.addHandler( transformationMessageEvent, messageEventHandler ); }
@Test( expected = HandlerRegistrationException.class ) public void testOperationDuplicateAddHandler() throws KettleException { messageEventService.addHandler( operationMessageEvent, messageEventHandler ); messageEventService.addHandler( operationMessageEvent, messageEventHandler ); }
@Test( expected = HandlerRegistrationException.class ) public void testMsgEventTypeNull() throws KettleException { messageEventService.addHandler( null, messageEventHandler ); }
@Test( expected = HandlerRegistrationException.class ) public void testMsgHandlerNull() throws KettleException { messageEventService.addHandler( operationMessageEvent, null ); }
@Test( expected = HandlerRegistrationException.class ) public void testbothNull() throws KettleException { messageEventService.addHandler( null, null ); }