junitparams.mappers
Class CsvWithHeaderMapper

java.lang.Object
  extended by junitparams.mappers.CsvWithHeaderMapper
All Implemented Interfaces:
DataMapper

public class CsvWithHeaderMapper
extends Object

Reads a CSV file starting from the second line - the first one is supposed to be a header. If you don't want to skip the first line, use @FilePatameters without any mapper.

Author:
Pawel Lipinski

Constructor Summary
CsvWithHeaderMapper()
           
 
Method Summary
 Object[] map(Reader reader)
          Maps file contents to parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvWithHeaderMapper

public CsvWithHeaderMapper()
Method Detail

map

public Object[] map(Reader reader)
Description copied from interface: DataMapper
Maps file contents to parameters. In your implementation read the data from the reader. The reader is closed in the framework, so just read it :) While reading transform the data into Object[][], where external dimension are different parameter sets, and internal dimension is the set of params per single test call You can optionally return Object[] with Strings inside, but each String must be a string in the same format as what you would normally pass to @Parameters({})

Specified by:
map in interface DataMapper
Returns:
an array with all parameter sets


Copyright © 2017 Pragmatists. All rights reserved.