diff --git a/jbehave-core/src/main/java/org/jbehave/core/model/ExamplesTableFactory.java b/jbehave-core/src/main/java/org/jbehave/core/model/ExamplesTableFactory.java index c9c8cda73..2daf1593a 100755 --- a/jbehave-core/src/main/java/org/jbehave/core/model/ExamplesTableFactory.java +++ b/jbehave-core/src/main/java/org/jbehave/core/model/ExamplesTableFactory.java @@ -99,6 +99,11 @@ public ExamplesTable createExamplesTable(String input) { String loadedTable = resourceLoader.loadResourceAsText(tableAsString.trim()); tablePropertiesQueue = tableParsers.parseProperties(loadedTable); Deque target = tablePropertiesQueue.getProperties(); + TableProperties headProperties = target.peekFirst(); + for (TableProperties outerProperties : properties) { + outerProperties.overrideSeparatorsFrom(headProperties); + target.addLast(outerProperties); + } boolean hasTransformers = target.getFirst().getTransformer() != null; if (hasTransformers) { @@ -115,7 +120,6 @@ public ExamplesTable createExamplesTable(String input) { target = tablePropertiesQueue.getProperties(); } } - properties.descendingIterator().forEachRemaining(target::addFirst); tablePropertiesQueue = new TablePropertiesQueue(tablePropertiesQueue.getTable(), target); } diff --git a/jbehave-core/src/test/java/org/jbehave/core/model/ExamplesTableFactoryBehaviour.java b/jbehave-core/src/test/java/org/jbehave/core/model/ExamplesTableFactoryBehaviour.java index 533d4e9cc..c46c507c8 100755 --- a/jbehave-core/src/test/java/org/jbehave/core/model/ExamplesTableFactoryBehaviour.java +++ b/jbehave-core/src/test/java/org/jbehave/core/model/ExamplesTableFactoryBehaviour.java @@ -145,8 +145,7 @@ void shouldLoadAndProperlyApplyTransformersForExamplesTableFromResourceInput() { // Then assertThat(examplesTable.asString(), equalTo( - innerTransformers - + lineFromFirstOuterTransformer + lineFromFirstOuterTransformer + lineFromSecondOuterTransformer + lineFromFirstInnerTransformer + lineFromSecondInnerTransformer)); @@ -179,7 +178,7 @@ void shouldLoadTableFromPathAndPreserveSeparators() { ExamplesTableFactory factory = new ExamplesTableFactory(new LoadFromClasspath(), new TableTransformers()); // When - ExamplesTable table = factory.createExamplesTable("data.table"); + ExamplesTable table = factory.createExamplesTable("{transformer=FORMATTING}\ndata.table"); // Then assertThat(table.getHeaders(), equalTo(asList("symbol", "threshold", "price", "status")));