@SuppressWarnings("rawtypes")
  @Before
  public void prepare() throws JavaModelException {
    stepLocator = mock(StepLocator.class);
    textAttributeProvider = mock(TextAttributeProvider.class);
    localizedStepSupport = new LocalizedStepSupport();
    localizedStepSupport.setStoryLocale(Locale.ENGLISH);
    jbehaveProject = mock(JBehaveProject.class);
    when(jbehaveProject.getLocalizedStepSupport()).thenReturn(localizedStepSupport);
    when(jbehaveProject.getStepLocator()).thenReturn(new StepLocator(jbehaveProject));
    when(jbehaveProject.getProjectPreferences()).thenReturn(new ProjectPreferences());
    doAnswer(
            new Answer() {
              @SuppressWarnings("unchecked")
              @Override
              public Object answer(InvocationOnMock invocation) throws Throwable {
                Visitor<StepCandidate, ?> visitor =
                    (Visitor<StepCandidate, ?>) invocation.getArguments()[0];
                visitor.visit(candidate);
                return null;
              }
            })
        .when(jbehaveProject)
        .traverseSteps(Mockito.<Visitor<StepCandidate, ?>>any());

    scanner =
        new StepScanner(jbehaveProject, textAttributeProvider) {
          @Override
          protected Token newToken(String styleId) {
            return new Token(styleId);
          }
        };
    document = new Document(GIVEN1);
    IMethod method = null;
    candidate = new StepCandidate(localizedStepSupport, "$", method, StepType.GIVEN, STEP1, 0);
  }
 protected LocalizedStepSupport getLocalizedStepSupport() {
   return jbehaveProject.getLocalizedStepSupport();
 }