Syntax { public void addStepImplementation(final StepImplementation impl) { stepImplementationsUsageMap.put(impl, new ArrayList<StepImplementationUsage>()); PatternMap<StepImplementation> patternMap = this.stepImplementationMap.get(impl.getKeyword()); if (patternMap == null) { patternMap = new PatternMap<StepImplementation>(); this.stepImplementationMap.put(impl.getKeyword(), patternMap); } final String pattern = impl.getValue(); if (!patternMap.containsPattern(pattern)) { try { patternMap.put(pattern, impl); } catch (final PatternSyntaxException e) { log.warn("Invalid step implementation pattern: " + e.getMessage() + "\n" + impl.getClass() + "." + impl.getMethod() + " will not be added to the syntax"); } } else { final StepImplementation implAlreadyGot = patternMap.getValueForPattern(pattern); if (!implAlreadyGot.getMethod().equals(impl.getMethod())) { final StepImplementationException ex = new DuplicateStepImplementationException(pattern, patternMap.getValueForPattern(pattern), impl); this.syntaxErrorReporter.reportStepImplError(ex); if (this.failOnDuplicateStepImplementations) { throw ex; } } else { } } } Syntax();  Syntax(final SyntaxErrorReporter syntaxErrorReporter); Map<String, PatternMap<StepImplementation>> getStepImplementationMap(); List<StepImplementation> getStepImplementations(); void setSubStepsMap(final PatternMap<ParentStep> loadSubSteps); PatternMap<ParentStep> getSubStepsMap(); List<ParentStep> getSortedRootSubSteps(); void addStepImplementation(final StepImplementation impl); void setStrict(final boolean strict, final String[] nonStrictKeywordPrecedence); void setFailOnDuplicateStepImplementations(final boolean failOnDuplicateStepImplementations); List<StepImplementation> getStepImplementations(final String keyword, final String parameterLine,
                                                           final File source, final int lineNumber); List<StepImplementation> checkForStepImplementations(final String keyword, final String parameterLine,
                                                                final File source, final int lineNumber); boolean isStrict(); String[] getNonStrictKeywordPrecedence(); List<StepImplementation> getUncalledStepImplementations();  }
@Test public void testInvalidPatternInStepImplDoesntStopSyntaxProcessing() throws Exception { this.syntax.addStepImplementation(stepImplementation("ExecuteQueryAndStashResults", "ExecuteQueryAndStashResults {([^}]*)}", StepDefinitionClass2.class, "method2")); }