commit e99fd88a00dd0045a1fbd7f65eca536f28fae372
Author: Mauro Talevi <[email protected]>
AuthorDate: Wed, 10 Apr 2013 01:18:45 +0200
Commit: Mauro Talevi <[email protected]>
CommitDate: Thu, 11 Apr 2013 08:58:40 +0200
JBEHAVE-896: Support Windows EOL in table rows.
diff --git
a/jbehave-core/src/main/java/org/jbehave/core/model/ExamplesTable.java
b/jbehave-core/src/main/java/org/jbehave/core/model/ExamplesTable.java
index dcc7f3c..76ede8d 100755
--- a/jbehave-core/src/main/java/org/jbehave/core/model/ExamplesTable.java
+++ b/jbehave-core/src/main/java/org/jbehave/core/model/ExamplesTable.java
@@ -136,7 +136,8 @@ public class ExamplesTable {
public static final ExamplesTable EMPTY = new ExamplesTable("");
- private static final String ROW_SEPARATOR = "\n";
+ private static final String ROW_SEPARATOR = "\r?\n";
+ private static final String NEW_LINE = "\n";
private static final String HEADER_SEPARATOR = "|";
private static final String VALUE_SEPARATOR = "|";
private static final String IGNORABLE_SEPARATOR = "|--";
@@ -216,7 +217,7 @@ public class ExamplesTable {
properties.setProperty("headerSeparator", headerSeparator);
properties.setProperty("valueSeparator", valueSeparator);
try {
- properties.load(new
ByteArrayInputStream(propertiesAsString.replace(",",
ROW_SEPARATOR).getBytes()));
+ properties.load(new
ByteArrayInputStream(propertiesAsString.replace(",", NEW_LINE).getBytes()));
} catch (IOException e) {
// carry on
}
@@ -381,13 +382,13 @@ public class ExamplesTable {
for (String header : headers) {
sb.append(headerSeparator).append(header);
}
- sb.append(headerSeparator).append(ROW_SEPARATOR);
+ sb.append(headerSeparator).append(NEW_LINE);
for (Map<String, String> row : getRows()) {
for (String header : headers) {
sb.append(valueSeparator);
sb.append(row.get(header));
}
- sb.append(valueSeparator).append(ROW_SEPARATOR);
+ sb.append(valueSeparator).append(NEW_LINE);
}
return sb.toString();
}