Pipeline implements ConnectionValidator, SettingsProvider, StepIndexer { public Set<Connection> getConnections() { return Collections.unmodifiableSet(this.connections); }  void clear(); final ImmutableList<Source> getSources(); final ImmutableList<Step> getSteps(); Set<Connection> getConnections(); @Override ProjectSettings getProjectSettings(); @Override AppSettings getAppSettings(); @Override CodeGenerationSettings getCodeGenerationSettings(); @SuppressWarnings("unchecked") @Override boolean canConnect(OutputSocket<?> outputSocket, InputSocket<?> inputSocket); @Subscribe void onSourceAdded(SourceAddedEvent event); @Subscribe void onSourceRemoved(SourceRemovedEvent event); void addStepBetween(Step stepToAdd, @Nullable Step lower, @Nullable Step higher); void moveStepBetween(Step toMove, @Nullable Step lower, @Nullable Step higher); void addStep(int index, Step step); void addStep(Step step); void removeStep(Step step); synchronized void moveStep(Step step, int delta); @Override int indexOf(Step step); @Subscribe void onConnectionAdded(ConnectionAddedEvent event); @Subscribe void onConnectionRemoved(ConnectionRemovedEvent event); @Subscribe void onProjectSettingsChanged(ProjectSettingsChangedEvent event); @Subscribe void onAppSettingsChanged(AppSettingsChangedEvent event); @Subscribe void onCodeGenerationSettingsChanged(CodeGenerationSettingsChangedEvent event);  }
@Test @SuppressWarnings("unchecked") public void testAddConnection() { Connection connection = new MockConnection(eventBus, pipeline); eventBus.post(new ConnectionAddedEvent(connection)); assertEquals("The connection was not added to the pipeline", Collections.singleton(connection), pipeline.getConnections()); }
@Test @SuppressWarnings("unchecked") public void testRemoveConnection() { Connection connection = new MockConnection(eventBus, pipeline); eventBus.post(new ConnectionAddedEvent(connection)); eventBus.post(new ConnectionRemovedEvent(connection)); assertTrue("The pipeline was not empty", pipeline.getConnections().isEmpty()); }