### Question:
TaskEventDispatcher { public void subscribeToEvent( ResultPartitionID partitionId, EventListener<TaskEvent> eventListener, Class<? extends TaskEvent> eventType) { checkNotNull(partitionId); checkNotNull(eventListener); checkNotNull(eventType); TaskEventHandler taskEventHandler; synchronized (registeredHandlers) { taskEventHandler = registeredHandlers.get(partitionId); } if (taskEventHandler == null) { throw new IllegalStateException( "Partition " + partitionId + " not registered at task event dispatcher."); } taskEventHandler.subscribe(eventListener, eventType); }  void registerPartition(ResultPartitionID partitionId); void unregisterPartition(ResultPartitionID partitionId); void subscribeToEvent(
			ResultPartitionID partitionId,
			EventListener<TaskEvent> eventListener,
			Class<? extends TaskEvent> eventType); boolean publish(ResultPartitionID partitionId, TaskEvent event); void clearAll();  }### Answer:
@Test public void subscribeToEventNotRegistered() throws Exception { TaskEventDispatcher ted = new TaskEventDispatcher(); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("not registered at task event dispatcher"); ted.subscribeToEvent(new ResultPartitionID(), new ZeroShotEventListener(), TaskEvent.class); }