PreparationUtils { public static Collection<Identifiable> scatter(Identifiable source) { final List<Identifiable> identifiableList = new LinkedList<>(); walk(source, (object) -> object instanceof Identifiable && identifiableList.add((Identifiable) object)); return identifiableList; }  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 scatterNull() throws Exception { final Collection<Identifiable> identifiableList = PreparationUtils.scatter(null); assertEquals(0, identifiableList.size()); }
@Test public void scatterStep() throws Exception { final Step step = new Step(); final Collection<Identifiable> identifiableList = PreparationUtils.scatter(step); assertEquals(1, identifiableList.size()); final Iterator<Identifiable> iterator = identifiableList.iterator(); assertEquals(step, iterator.next()); }
@Test public void scatterPreparationAction() throws Exception { final PreparationActions preparationActions = new PreparationActions(); final Collection<Identifiable> identifiableList = PreparationUtils.scatter(preparationActions); assertEquals(1, identifiableList.size()); assertEquals(preparationActions, identifiableList.iterator().next()); }
@Test public void scatterPreparation() throws Exception { final Preparation preparation = new Preparation(); final Step step1 = new FixedIdStep("step-1234"); final Step step2 = new FixedIdStep("step-5678"); preparation.setSteps(Arrays.asList(step1, step2)); repository.add(preparation); final Collection<Identifiable> identifiableList = PreparationUtils.scatter(preparation); assertEquals(3, identifiableList.size()); final Iterator<Identifiable> iterator = identifiableList.iterator(); assertEquals(preparation, iterator.next()); assertEquals(step1, iterator.next()); assertEquals(step2, iterator.next()); }