Skip to content

Commit

Permalink
Better table conversion. Closes #433,#434.
Browse files Browse the repository at this point in the history
  • Loading branch information
DFUK authored and DFUK committed Dec 5, 2012
1 parent f79d5d6 commit ff6dca4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [Git master](https://github.com/cucumber/cucumber-jvm/compare/v1.1.1...master)

* [Core] Support `DataTable.toTable(List<String[]>) and `DataTable.toTable(List<Map<String,String>>)` ([#433](https://github.com/cucumber/cucumber-jvm/issues/433), [#434](https://github.com/cucumber/cucumber-jvm/pull/434) Nicholas Albion, Aslak Hellesøy)
* [Core] Formatters and `--dotcucumber` can now write to a file or an URL (via HTTP PUT). This allows easier distribution of reports. (Aslak Hellesøy)
* [JUnit] Added `@Cucumber.Options.dotcucumber`, allowing metadata to be written from JUnit. Useful for code completion. ([#418](https://github.com/cucumber/cucumber-jvm/issues/418 Aslak Hellesøy)
* [Core] Embedded data fails to display in HTML reports due to invalid string passed from HTMLFormatter ([#412](https://github.com/cucumber/cucumber-jvm/issues/412) Aslak Hellesøy)
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/cucumber/api/DataTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ public static DataTable create(List<?> raw) {
return create(raw, Locale.getDefault(), null, new String[0]);
}

public static DataTable create(List<?> raw, String dateFormat, String... columnNames) {
return create(raw, Locale.getDefault(), dateFormat, columnNames);
public static DataTable create(List<?> raw, String format, String... columnNames) {
return create(raw, Locale.getDefault(), format, columnNames);
}

public static DataTable create(List<?> raw, Locale locale, String... columnNames) {
return create(raw, locale, null, columnNames);
}

private static DataTable create(List<?> raw, Locale locale, String dateFormat, String... columnNames) {
ParameterInfo parameterInfo = new ParameterInfo(null, dateFormat, null, null);
private static DataTable create(List<?> raw, Locale locale, String format, String... columnNames) {
ParameterInfo parameterInfo = new ParameterInfo(null, format, null, null);
TableConverter tableConverter = new TableConverter(new LocalizedXStreams(Thread.currentThread().getContextClassLoader()).get(locale), parameterInfo);
return tableConverter.toTable(raw, columnNames);
}
Expand Down Expand Up @@ -74,7 +74,7 @@ public List<List<String>> raw() {
}

public <T> T convert(Type type) {
return tableConverter.<T>convert(type, this);
return tableConverter.convert(type, this);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public <T> List<T> toList(final Type type, DataTable dataTable) {
* Converts a List of objects to a DataTable.
*
* @param objects the objects to convert
* @param columnNames an explicit list of column names (currently not used)
* @param columnNames an explicit list of column names
* @return a DataTable
*/
public DataTable toTable(List<?> objects, String... columnNames) {
Expand Down

0 comments on commit ff6dca4

Please sign in to comment.