AbstractReader implements ReaderBase { protected boolean handleEvent(AbstractEvent event) throws IOException { final Class<?> eventType = event.getClass(); try { if (eventType == EndOfPartitionEvent.class) { return true; } else if (eventType == EndOfSuperstepEvent.class) { return incrementEndOfSuperstepEventAndCheck(); } else if (event instanceof TaskEvent) { taskEventHandler.publish((TaskEvent) event); return false; } else { throw new IllegalStateException("Received unexpected event of type " + eventType + " at reader."); } } catch (Throwable t) { throw new IOException("Error while handling event of type " + eventType + ": " + t.getMessage(), t); } } protected  AbstractReader(InputGate inputGate); @Override boolean isFinished(); @Override void registerTaskEventListener(EventListener<TaskEvent> listener, Class<? extends TaskEvent> eventType); @Override void sendTaskEvent(TaskEvent event); void publish(TaskEvent event); @Override void setIterativeReader(); @Override void startNextSuperstep(); @Override boolean hasReachedEndOfSuperstep();  }
@Test public void testEndOfPartitionEvent() throws Exception { final AbstractReader reader = new MockReader(createInputGate(1)); assertTrue(reader.handleEvent(EndOfPartitionEvent.INSTANCE)); }