Pipeline implements ConnectionValidator, SettingsProvider, StepIndexer { @Override public int indexOf(Step step) { checkNotNull(step, "step"); return readStepsSafely(steps -> steps.indexOf(step)); }  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("PMD.EmptyCatchBlock") public void testIndexOf() { Step step = MockStep.createMockStepWithOperation(); pipeline.addStep(step); assertEquals("Index of step was not zero", 0, pipeline.indexOf(step)); pipeline.removeStep(step); assertEquals("Index was not -1", -1, pipeline.indexOf(step)); }