SyntaxAwareStepValidator implements StepValidator { @Override public void validateFeatureFile(final FeatureFile featureFile, final SyntaxErrorReporter syntaxErrorReporter) { final List<Scenario> scenarios = featureFile.getScenarios(); if (scenarios != null) { for (final Scenario scenario : scenarios) { validate(scenario, featureFile.getSourceFile(), syntaxErrorReporter); } } } SyntaxAwareStepValidator(final Syntax syntax); @Override void validateFeatureFile(final FeatureFile featureFile, final SyntaxErrorReporter syntaxErrorReporter); @Override void validateSubstep(final ParentStep substep, final SyntaxErrorReporter syntaxErrorReporter);  }
@Test public void validatorReportsMissingStepsInScenario() { File ff = createFeatureFile("error.feature"); final FeatureFile featureFile = this.featureFileParser.loadFeatureFile(ff); createStepValidatorWithSubsteps("simple.substeps", mock).validateFeatureFile(featureFile, mock); verify(mock).reportFeatureError(eq(ff), eq("Given step 1"), eq(6), anyInt(), any()); verify(mock).reportFeatureError(eq(ff), eq("Given step 2"), eq(7), anyInt(), any()); }
@Test public void validatorReportsNoErrorsForFeatureWithValidSteps() { final FeatureFile featureFile = this.featureFileParser.loadFeatureFile(createFeatureFile("error.feature")); createStepValidatorWithSubsteps("error.substeps",mock).validateFeatureFile(featureFile, mock); verify(mock, never()).reportFeatureError(any(),any(),anyInt(),anyInt(),any()); verify(mock, never()).reportSubstepsError(any()); verify(mock, never()).reportStepImplError(any()); }