SubStepDefinitionParser { public PatternMap<ParentStep> loadSubSteps(final File definitions) { final Collection<File> substepsFiles = FileUtils.getFiles(definitions, "substeps"); for (final File f : substepsFiles) { parseSubStepFile(f); } return this.parentMap; } SubStepDefinitionParser(final SyntaxErrorReporter syntaxErrorReporter);  SubStepDefinitionParser(final boolean failOnDuplicateSubsteps, final SyntaxErrorReporter syntaxErrorReporter); PatternMap<ParentStep> parseSubstepFileContents(FileContents currentFileContents); PatternMap<ParentStep> loadSubSteps(final File definitions);  }
@Test public void testCommentOnEol() { this.parser = new SubStepDefinitionParser(FAIL_ON_DUPLICATE_SUBSTEPS, this.errorReporter); final PatternMap<ParentStep> substepDefs = this.parser.loadSubSteps(new File( "./target/test-classes/com/technophobia/substeps/runner/syntax/eol-comment.substeps")); Assert.assertNotNull(substepDefs); final String def1 = "something else"; List<ParentStep> list = substepDefs.get(def1); Assert.assertThat(list, hasSize(1)); ParentStep parentStep = list.get(0); String line = parentStep.getParent().getLine(); Assert.assertThat(line, is(def1)); final String def2 = "and something different"; list = substepDefs.get(def2); Assert.assertThat(list, hasSize(1)); parentStep = list.get(0); line = parentStep.getParent().getLine(); Assert.assertThat(line, is(def2)); final String commentedDefine = "a normal comment"; list = substepDefs.get(commentedDefine); Assert.assertThat(list, empty()); }
@Ignore @Test public void shouldNotLoadEmptySubStepDefinitions() { fail("This was copied from a previous test, but may be invalid."); final SubStepDefinitionParser parser = new SubStepDefinitionParser(new DefaultSyntaxErrorReporter()); final PatternMap<ParentStep> loadedSubSteps = parser.loadSubSteps(new File( "./target/test-classes/substeps/error.substeps")); Assert.assertFalse(loadedSubSteps.containsPattern("An empty substep definition")); }