• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 package junitparams.converters;
3 
4 import java.lang.annotation.ElementType;
5 import java.lang.annotation.Retention;
6 import java.lang.annotation.RetentionPolicy;
7 import java.lang.annotation.Target;
8 
9 import junitparams.Parameters;
10 
11 /**
12  * Allows test null values defined as a String array in {@link Parameters}
13  *
14  * @author Peter Jurkovic
15  *
16  * <p>
17  * Example:
18  * <pre>
19  * {@literal @}Test
20  * {@literal @}Parameters({" null "})
21  * public void shouldBeNull({@literal @}Nullable String value) {
22  *     assertThat(value).isNull();
23  * }
24  * </pre>
25  * </p>
26  */
27 @Retention(RetentionPolicy.RUNTIME)
28 @Param(converter = NullableConverter.class)
29 @Target({ElementType.ANNOTATION_TYPE, ElementType.PARAMETER})
30 public @interface Nullable {
31 
32     /**
33      * Defines parameter value which will be replaced by Java null
34      */
nullIdentifier()35     String nullIdentifier() default "null";
36 }
37