PreparationUtils { public List<String> listStepsIds(final String stepId, final PreparationRepository repository) { return listStepsIds(stepId, Step.ROOT_STEP.getId(), repository); }  static void prettyPrint(PreparationRepository repository, Preparation preparation, OutputStream out); static Collection<Identifiable> scatter(Identifiable source); List<String> listStepsIds(final String stepId, final PreparationRepository repository); List<String> listStepsIds(final String stepId, final String limit, final PreparationRepository repository); List<Step> listSteps(String headStepId, PreparationRepository repository); List<Step> listSteps(final Step step, final String limit, final PreparationRepository repository); static List<String> getPreparationIdForStepRowMetadata(final List<String> stepRowMetadataUpdated,
            final PreparationRepository repository);  }
@Test public void should_list_steps_ids_history_from_root() { final List<Action> actions = getSimpleAction("uppercase", "column_name", "lastname"); final PreparationActions newContent1 = PreparationActions.ROOT_ACTIONS.append(actions); final PreparationActions newContent2 = newContent1.append(actions); final String version = versionService.version().getVersionId(); final Step step1 = new Step(Step.ROOT_STEP.id(), newContent1.id(), version); final Step step2 = new Step(step1.id(), newContent2.id(), version); repository.add(newContent1); repository.add(newContent2); repository.add(step1); repository.add(step2); List<String> ids = preparationUtils.listStepsIds(step1.id(), repository); assertThat(ids, hasItem(Step.ROOT_STEP.id())); assertThat(ids, hasItem(step1.id())); assertThat(ids, not(hasItem(step2.id()))); ids = preparationUtils.listStepsIds(step2.id(), repository); assertThat(ids, hasItem(Step.ROOT_STEP.id())); assertThat(ids, hasItem(step1.id())); assertThat(ids, hasItem(step2.id())); }
@Test public void should_list_steps_ids_history_from_limit() { final List<Action> actions = getSimpleAction("uppercase", "column_name", "lastname"); final PreparationActions newContent1 = PreparationActions.ROOT_ACTIONS.append(actions); final PreparationActions newContent2 = newContent1.append(actions); final String version = versionService.version().getVersionId(); final Step step1 = new Step(Step.ROOT_STEP.id(), newContent1.id(), version); final Step step2 = new Step(step1.id(), newContent2.id(), version); repository.add(newContent1); repository.add(newContent2); repository.add(step1); repository.add(step2); List<String> ids = preparationUtils.listStepsIds(step2.id(), step1.getId(), repository); assertThat(ids, not(hasItem(Step.ROOT_STEP.id()))); assertThat(ids, hasItem(step1.id())); assertThat(ids, hasItem(step2.id())); ids = preparationUtils.listStepsIds(step2.id(), step2.getId(), repository); assertThat(ids, not(hasItem(Step.ROOT_STEP.id()))); assertThat(ids, not(hasItem(step1.id()))); assertThat(ids, hasItem(step2.id())); }