Permalink
Browse files

replaced tabs with spaces and removed unwanted method

  • Loading branch information...
1 parent aba756a commit 77decde8ff70943c24b58a5cb9860a22cc4e34e3 Roberto Lo Giacco committed Nov 23, 2013
View
22 core/src/main/java/cucumber/api/DataTable.java
@@ -65,7 +65,7 @@ public DataTable(List<DataTableRow> gherkinRows, TableConverter tableConverter)
}
private DataTable(List<DataTableRow> gherkinRows, List<List<String>> raw, TableConverter tableConverter) {
- this.gherkinRows = gherkinRows;
+ this.gherkinRows = gherkinRows;
this.tableConverter = tableConverter;
this.raw = Collections.unmodifiableList(raw);
}
@@ -113,22 +113,6 @@ private DataTable(List<DataTableRow> gherkinRows, List<List<String>> raw, TableC
List<T> result = tableConverter.toList(type, this, false);
return result;
}
-
- /**
- * Converts the table to a List of objects. The first column is used to identifies the fields/properties
- * of the objects.
- * <p/>
- * Backends that support generic types can declare a parameter as a List of a type, and Cucumber will
- * do the conversion automatically.
- *
- * @param type the type of the result (should be a {@link List} generic type)
- * @param <T> the type of each object
- * @return a list of objects
- */
- public <T> List<T> asTransposedList(Type type) {
- List<T> result = tableConverter.toList(type, this, true);
- return result;
- }
public List<String> topCells() {
return raw.get(0);
@@ -213,9 +197,9 @@ public TableConverter getTableConverter() {
}
return result;
}
-
+
public DataTable transpose() {
- List<List<String>> transposed = new ArrayList<List<String>>();
+ List<List<String>> transposed = new ArrayList<List<String>>();
for (int i = 0; i < gherkinRows.size(); i++) {
Row gherkinRow = gherkinRows.get(i);
for (int j = 0; j < gherkinRow.getCells().size(); j++) {
View
6 core/src/main/java/cucumber/runtime/ParameterInfo.java
@@ -63,9 +63,9 @@
}
public ParameterInfo(Type type, String format, String delimiter, Transformer transformer) {
- this(type, format, delimiter, false, transformer);
+ this(type, format, delimiter, false, transformer);
}
-
+
public ParameterInfo(Type type, String format, String delimiter, boolean transposed, Transformer transformer) {
this.type = type;
this.format = format;
@@ -89,7 +89,7 @@ public ParameterInfo(Type type, String format, String delimiter, boolean transpo
public Type getType() {
return type;
}
-
+
public boolean isTransposed() {
return transposed;
}
View
4 core/src/main/java/cucumber/runtime/table/TableConverter.java
@@ -55,9 +55,9 @@ public TableConverter(LocalizedXStreams.LocalizedXStream xStream, ParameterInfo
if (itemType == null) {
throw new CucumberException("Not a List type: " + type);
}
-
+
if (transposed) {
- dataTable = dataTable.transpose();
+ dataTable = dataTable.transpose();
}
Type listItemType = listItemType(itemType);
View
12 core/src/test/java/cucumber/runtime/table/DataTableTest.java
@@ -25,7 +25,7 @@ public void rawShouldHaveThreeColumnsAndTwoRows() {
assertEquals("Cols size: " + list, 3, list.size());
}
}
-
+
@Test
public void transposedRawShouldHaveTwoColumnsAndThreeRows() {
List<List<String>> raw = createSimpleTable().transpose().raw();
@@ -34,7 +34,7 @@ public void transposedRawShouldHaveTwoColumnsAndThreeRows() {
assertEquals("Cols size: " + list, 2, list.size());
}
}
-
+
@Test
public void canTransposeNonRectangularTables() {
List<List<String>> raw = createNonRectangularTable().transpose().raw();
@@ -107,12 +107,12 @@ public void two_different_transposed_tables_are_considered_non_equal() {
public DataTable createSimpleTable() {
return createTable(asList("one", "four", "seven"), asList("4444", "55555", "666666"));
}
-
+
public DataTable createNonRectangularTable() {
return createTable(asList("one", "four", "seven"),
- asList("a1", "a4444", "a7777777", "zero"),
- asList("b1"),
- asList("c1", "c4444"));
+ asList("a1", "a4444", "a7777777", "zero"),
+ asList("b1"),
+ asList("c1", "c4444"));
}
private DataTable createTable(List<String>... rows) {
View
12 core/src/test/java/cucumber/runtime/table/FromDataTableTest.java
@@ -56,23 +56,23 @@ public void listOfPrimitiveContainers(List<PrimitiveContainer> primitiveContaine
public void listOfPojos(@Format("yyyy-MM-dd") List<UserPojo> listOfPojos) {
this.listOfPojos = listOfPojos;
}
-
+
public void listOfPojosTransposed(@Transpose @Format("yyyy-MM-dd") List<UserPojo> listOfPojos) {
this.listOfPojos = listOfPojos;
}
public void listOfBeans(@Format("yyyy-MM-dd") List<UserBean> listOfBeans) {
this.listOfBeans = listOfBeans;
}
-
+
public void listOfBeansTransposed(@Transpose @Format("yyyy-MM-dd") List<UserBean> listOfBeans) {
this.listOfBeans = listOfBeans;
}
public void listOfUsersWithNameField(@Format("yyyy-MM-dd") List<UserWithNameField> listOfUsersWithNameField) {
this.listOfUsersWithNameField = listOfUsersWithNameField;
}
-
+
public void listOfUsersTransposedWithNameField(@Transpose @Format("yyyy-MM-dd") List<UserWithNameField> listOfUsersWithNameField) {
this.listOfUsersWithNameField = listOfUsersWithNameField;
}
@@ -151,7 +151,7 @@ public void transforms_to_list_of_beans() throws Throwable {
StepDefs stepDefs = runStepDef(m, listOfDatesWithHeader());
assertEquals(sidsBirthday(), stepDefs.listOfBeans.get(0).getBirthDate());
}
-
+
@Test
public void transforms_to_list_of_beans_transposed() throws Throwable {
Method m = StepDefs.class.getMethod("listOfBeansTransposed", List.class);
@@ -167,7 +167,7 @@ public void converts_table_to_list_of_class_with_special_fields() throws Throwab
assertEquals("Sid", stepDefs.listOfUsersWithNameField.get(0).name.first);
assertEquals("Vicious", stepDefs.listOfUsersWithNameField.get(0).name.last);
}
-
+
@Test
public void converts_table_to_list_of_class_with_special_fields_transposed() throws Throwable {
Method m = StepDefs.class.getMethod("listOfUsersTransposedWithNameField", List.class);
@@ -254,7 +254,7 @@ private StepDefs runStepDef(Method method, List<DataTableRow> rows) throws Throw
rows.add(new DataTableRow(NO_COMMENTS, asList("1000", "999"), 2));
return rows;
}
-
+
private List<DataTableRow> transposedListOfDatesWithHeader() {
List<DataTableRow> rows = new ArrayList<DataTableRow>();
rows.add(new DataTableRow(NO_COMMENTS, asList("Birth Date", "1957-05-10"), 1));

0 comments on commit 77decde

Please sign in to comment.