Home | History | Annotate | Download | only in mappers
      1 package junitparams.mappers;
      2 
      3 import java.io.*;
      4 
      5 /**
      6  * Interface to be used by FileParameters'ized test methods. If you want to read
      7  * your own format of data from file, implement the map method appropriately.
      8  * For CSV files, just skip it.
      9  *
     10  * @author Pawel Lipinski
     11  *
     12  */
     13 public interface DataMapper {
     14     /**
     15      * Maps file contents to parameters. In your implementation read the data
     16      * from the reader. The reader is closed in the framework, so just read it
     17      * :)
     18      *
     19      * While reading transform the data into Object[][], where external
     20      * dimension are different parameter sets, and internal dimension is the set
     21      * of params per single test call
     22      *
     23      * You can optionally return Object[] with Strings inside, but each String
     24      * must be a string in the same format as what you would normally pass to
     25      * @Parameters({})
     26      *
     27      * @param reader
     28      * @return an array with all parameter sets
     29      */
     30     Object[] map(Reader reader);
     31 }
     32