You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we have found an issue with the datatable conversion. It fails when there are different type of classes using ClassWithStringAssignableConstructorConverter
Feature: Convert datatable properly
Scenario: I should be able to load a org.joda.time.LocalDate|org.joda.time.LocalTime|org.joda.time.LocalDate in that order
When I load a table like
| date1 | time1 | date2 |
| 2014-06-17 | 17:30:00.000 | 2014-06-18 |
---
import org.joda.time.LocalDate;
import org.joda.time.LocalTime;
public class CucumberBug {
private LocalDate date1;
private LocalTime time1;
private LocalDate date2;
public LocalDate getDate1() {
return date1;
}
public void setDate1(final LocalDate date1) {
this.date1 = date1;
}
public LocalTime getTime1() {
return time1;
}
public void setTime1(final LocalTime time1) {
this.time1 = time1;
}
public LocalDate getDate2() {
return date2;
}
public void setDate2(final LocalDate date2) {
this.date2 = date2;
}
}
---
public class CucumberBugSteps {
@When("^I load a table like$")
public void i_load_a_table_like(final DataTable table) throws Throwable {
final List<CucumberBug> list = table.asList(CucumberBug.class);
assertEquals(list.get(0).getDate1(), new LocalDate("2014-06-17"));
assertEquals(list.get(0).getTime1(), new LocalTime("17:30:00"));
assertEquals(list.get(0).getDate2(), new LocalDate("2014-06-18"));
}
}
We think the problem is around the method com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType
First time, the method get called, it will add and return
LocalDate.class -> ClassWithStringAssignableConstructorConverter(ctor as Localdate assigned during canConvert) (line 56-57)
Second time, the method get called, it will add and return
LocalTime.class -> ClassWithStringAssignableConstructorConverter(ctor as LocalTime assigned during canConvert) (line 56-57)
Third time, the method get called, it will return a ClassWithStringAssignableConstructorConverter(ctor as LocalTime) for a LocalDate because it is now cached. (Line 51)
We are using cucumber-java 1.1.7
Re-ordering the table may work in the example above, but when there are various tables used it will not work.
Thanks,
Kenny
The text was updated successfully, but these errors were encountered:
mgurov
pushed a commit
to mgurov/cucumber-jvm
that referenced
this issue
Jun 17, 2014
Hi, we have found an issue with the datatable conversion. It fails when there are different type of classes using ClassWithStringAssignableConstructorConverter
We think the problem is around the method com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType
First time, the method get called, it will add and return
LocalDate.class -> ClassWithStringAssignableConstructorConverter(ctor as Localdate assigned during canConvert) (line 56-57)
Second time, the method get called, it will add and return
LocalTime.class -> ClassWithStringAssignableConstructorConverter(ctor as LocalTime assigned during canConvert) (line 56-57)
Third time, the method get called, it will return a ClassWithStringAssignableConstructorConverter(ctor as LocalTime) for a LocalDate because it is now cached. (Line 51)
We are using cucumber-java 1.1.7
Re-ordering the table may work in the example above, but when there are various tables used it will not work.
Thanks,
Kenny
The text was updated successfully, but these errors were encountered: