@Test
public void shouldMarkUnusedSteps() {

    // Given
    final UUID stepMarker = UUID.randomUUID();
    final StepMarker marker = new PreparationStepMarker();
    final PreparationRepository repository = mock(PreparationRepository.class);
    final Preparation preparation = new Preparation();
    final Step step = mock(Step.class);
    when(step.id()).thenReturn("1234");
    when(step.getParent()).thenReturn(Step.ROOT_STEP.id());
    when(repository.get(eq("1234"), eq(Step.class))).thenReturn(step);
    preparation.setSteps(Arrays.asList(Step.ROOT_STEP, step));
    when(repository.list(eq(Preparation.class))).thenReturn(Stream.of(preparation));
    // When
    final StepMarker.Result result = marker.mark(repository, stepMarker);
    // Then
    assertEquals(StepMarker.Result.COMPLETED, result);
    verify(repository, times(1)).add(eq(Collections.singletonList(step)));
    verify(step, times(1)).setMarker(eq(stepMarker.toString()));
}