### Question:
TaskEventDispatcher { public void registerPartition(ResultPartitionID partitionId) { checkNotNull(partitionId); synchronized (registeredHandlers) { LOG.debug("registering {}", partitionId); if (registeredHandlers.put(partitionId, new TaskEventHandler()) != null) { throw new IllegalStateException( "Partition " + partitionId + " already registered at task event dispatcher."); } } }  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 registerPartitionTwice() throws Exception { ResultPartitionID partitionId = new ResultPartitionID(); TaskEventDispatcher ted = new TaskEventDispatcher(); ted.registerPartition(partitionId); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("already registered at task event dispatcher"); ted.registerPartition(partitionId); }