junitparams.internal
Class IdentityMapper

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

public class IdentityMapper
extends Object
implements DataMapper

A mapper, that maps contents of a file to a set of parameters for test methods. Basically a CSV with no header and ordering of columns exactly like the one in the test methods. It uses the logic from @Parameters({}) for parsing lines of file, so be sure the columns in the file match exactly the ordering of arguments in the test method.

Author:
Pawel Lipinski

Constructor Summary
IdentityMapper()
           
 
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

IdentityMapper

public IdentityMapper()
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 © 2012 Pragmatists. All Rights Reserved.