Class AbstractCsvDataProvider
- java.lang.Object
-
- dev.aherscu.qa.jgiven.commons.utils.AbstractCsvDataProvider
-
public abstract class AbstractCsvDataProvider extends Object
Generic CSV data provider; you should specialize it for your type by overridingtype()
, like this:public static final class FooCsvDataProvider extends AbstractCsvDataProvider { @Override protected Class> type() { return Foo.class; } }
then you can use it like this:@Test(dataProviderClass = FooCsvDataProvider.class, dataProvider = AbstractCsvDataProvider.DATA) public void shouldReadFromCsv(final Foo value) {...}
Only a single object parameter is supported. If your test method requires multiple parameters, then consider grouping them in a class instead.- Author:
- aherscu
-
-
Constructor Summary
Constructors Constructor Description AbstractCsvDataProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected com.opencsv.bean.CsvToBeanBuilder<Object>
csvBuilderFor(Reader csvReader)
Object[]
data(Method method)
protected abstract Class<?>
type()
-
-
-
Field Detail
-
DATA
public static final String DATA
- See Also:
- Constant Field Values
-
-
Method Detail
-
csvBuilderFor
protected com.opencsv.bean.CsvToBeanBuilder<Object> csvBuilderFor(Reader csvReader)
- Parameters:
csvReader
- the reader for associated CSV file- Returns:
- iterator over deserialized CSV data
-
type
protected abstract Class<?> type()
- Returns:
- the type of data that should be deserialized
-
-