|
26 | 26 | import static org.testingisdocumenting.webtau.data.DataContentUtils.dataTextContent; |
27 | 27 |
|
28 | 28 | public class DataCsv { |
| 29 | + /** |
| 30 | + * Use <code>data.csv.table</code> to read data as {@link TableData} from CSV file. |
| 31 | + * Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. |
| 32 | + * @param fileOrResourcePath relative path, absolute path or classpath resource path |
| 33 | + * @return table data with CSV content |
| 34 | + */ |
29 | 35 | public TableData table(String fileOrResourcePath) { |
30 | 36 | return tableFromListOfMaps(CsvUtils.parse(textContent(fileOrResourcePath))); |
31 | 37 | } |
32 | 38 |
|
| 39 | + /** |
| 40 | + * Use <code>data.csv.tableAutoConverted</code> to read data as {@link TableData} from CSV file. Numeric values become values of Numeric type instead of String type. |
| 41 | + * Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. |
| 42 | + * |
| 43 | + * @param fileOrResourcePath relative path, absolute path or classpath resource path |
| 44 | + * @return table data with CSV content |
| 45 | + */ |
33 | 46 | public TableData tableAutoConverted(String fileOrResourcePath) { |
34 | 47 | return tableFromListOfMaps(CsvUtils.parseWithAutoConversion(textContent(fileOrResourcePath))); |
35 | 48 | } |
36 | 49 |
|
| 50 | + /** |
| 51 | + * Use <code>data.csv.listOfMaps</code> to read data as {@link java.util.List} of {@link java.util.Map} from CSV file. |
| 52 | + * Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. |
| 53 | + * |
| 54 | + * @param fileOrResourcePath relative path, absolute path or classpath resource path |
| 55 | + * @return list of maps |
| 56 | + */ |
37 | 57 | public List<Map<String, String>> listOfMaps(String fileOrResourcePath) { |
38 | 58 | return CsvUtils.parse(textContent(fileOrResourcePath)); |
39 | 59 | } |
40 | 60 |
|
| 61 | + /** |
| 62 | + * Use <code>data.csv.listOfMaps</code> to read data as {@link java.util.List} of {@link java.util.Map} from CSV file. |
| 63 | + * Numeric values become values of Numeric type instead of String type. |
| 64 | + * Passed path is either relative based on working dir or absolute path. Or it can be a resource class path. |
| 65 | + * |
| 66 | + * @param fileOrResourcePath relative path, absolute path or classpath resource path |
| 67 | + * @return list of maps |
| 68 | + */ |
41 | 69 | public List<Map<String, Object>> listOfMapsAutoConverted(String fileOrResourcePath) { |
42 | 70 | return CsvUtils.parseWithAutoConversion(textContent(fileOrResourcePath)); |
43 | 71 | } |
|
0 commit comments