• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package junitparams;
2 
3 import java.lang.annotation.ElementType;
4 import java.lang.annotation.Retention;
5 import java.lang.annotation.RetentionPolicy;
6 import java.lang.annotation.Target;
7 
8 import junitparams.custom.CustomParameters;
9 import junitparams.custom.FileParametersProvider;
10 import junitparams.mappers.DataMapper;
11 import junitparams.mappers.IdentityMapper;
12 
13 /**
14  * Denotes that parameters for a annotated test method should be taken from an
15  * external resource.
16  *
17  * @author Pawel Lipinski
18  */
19 @Retention(RetentionPolicy.RUNTIME)
20 @Target(ElementType.METHOD)
21 @CustomParameters(provider = FileParametersProvider.class)
22 public @interface FileParameters {
23 
24     /**
25      * File name (with full path) of the file with data.
26      */
value()27     String value();
28 
29     /**
30      * The mapper which knows how to get the data from the external resource and
31      * turn it into a valid set of parameters. By default it is an
32      * IdentityMapper, meaning the resource has exactly the same format as the
33      * <p/>
34      * &#064;Parameters annotation value (when passed as String), being CSV.
35      */
mapper()36     Class<? extends DataMapper> mapper() default IdentityMapper.class;
37 
38     /**
39      * Encoding to use when reading file contents.
40      */
encoding()41     String encoding() default "UTF-8";
42 
43 }
44