Skip to content

Commit 4d161de

Browse files
committed
Fixed bug where data table did not properly render strings in cells.
1 parent 8f7f54c commit 4d161de

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.google.pdsl</groupId>
88
<artifactId>pdsl</artifactId>
9-
<version>1.11.1</version>
9+
<version>1.11.2-SNAPSHOT</version>
1010

1111
<name>pdsl</name>
1212
<url>http://www.github.com/google/polymorphicDSL</url>

src/main/java/com/pdsl/gherkin/models/GherkinStep.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.pdsl.gherkin.models;
22

33
import java.util.*;
4+
import java.util.stream.Collectors;
45

56
public class GherkinStep {
67

@@ -51,7 +52,17 @@ public String getFullRawStepText() {
5152
if (docString.isPresent()) {
5253
str.append(docString.get().getGherkinString().getRawString());
5354
} else if (dataTable.isPresent()) {
54-
str.append(dataTable.get().toString());
55+
StringBuilder tableAsString = new StringBuilder();
56+
// Reconstruct the cell data back into gherkin
57+
for (List<GherkinString> row : dataTable.get()) {
58+
tableAsString.append("|"); // Add leading pipe
59+
String rowAsString = row.stream()
60+
.map(GherkinString::getRawString)
61+
.collect(Collectors.joining("|"));
62+
tableAsString.append(rowAsString);
63+
tableAsString.append(String.format("|%n")); // Add ending pipe with a newline
64+
}
65+
str.append(tableAsString);
5566
}
5667
return str.toString();
5768
}

0 commit comments

Comments
 (0)