1## JUnitParams 1.0.5 release. Release date : ? 2 3### Deprecated $ method 4Utility method `$` was deprecated. It was causing too much problems and we decided not to support it any more. If you wish to keep using it, implement it in your own codebase. 5 6### Automatic class name to class object conversion 7 8```java 9 10 @Test 11 @Parameters({"java.lang.Object", "java.lang.String"}) 12 public void passClassAsString(Class<?> clazz) { 13 assertThat(clazz).isIn(java.lang.Object.class, java.lang.String.class); 14 } 15``` 16 17Thanks to [adammichalik](https://github.com/adammichalik) for contribution 18 19### Support custom annotations for parameter conversion 20 21You can create your own annotations for parameter conversion. Just annotate it with `@Param` and pass it a reference to `Converter` implementation. 22 23Example: 24 25 26```java 27 28 @Retention(RetentionPolicy.RUNTIME) 29 @Target(ElementType.PARAMETER) 30 @Param(converter = FormattedDateConverter.class) 31 public @interface DateParam { 32 33 String format() default "dd.MM.yyyy"; 34 } 35 36 public static class FormattedDateConverter implements Converter<DateParam, Date> { 37 38 private String format; 39 40 @Override 41 public void initialize(DateParam annotation) { 42 this.format = annotation.format(); 43 } 44 45 @Override 46 public Date convert(Object param) throws ConversionFailedException { 47 try { 48 return new SimpleDateFormat(format).parse(param.toString()); 49 } catch (ParseException e) { 50 throw new ConversionFailedException("failed"); 51 } 52 } 53 } 54``` 55 56Usage example: 57 58```java 59 60 @Test 61 @Parameters({"2012-12-01"}) 62 public void testWithConvertedDate(@DateParam Date date) { 63 assertThat(...); 64 } 65``` 66 67Thanks to [bbobcik](https://github.com/bbobcik) for inspiration 68 69### CustomParameters 70 71You can create custom annotations for parameter providers. `@FileParameters` have been refactored to use this mechanism and should serve as a perfect usage example. 72 73```java 74 75 @Retention(RetentionPolicy.RUNTIME) 76 @Target(ElementType.METHOD) 77 @CustomParameters(provider = FileParametersProvider.class) 78 public @interface FileParameters { 79 80 String fileLocation(); 81 82 } 83 84 public class FileParametersProvider implements ParametersProvider<FileParameters> { 85 86 private String fileLocation; 87 88 @Override 89 public void initialize(FileParameters fileParameters) { 90 this.fileLocation = fileParameters.fileLocation(); 91 } 92 93 @Override 94 public Object[] getParameters() { 95 return paramsFromFile(fileLocation); 96 } 97 98 ... 99 } 100 101``` 102 103### @CombinedParameters 104 105Thanks to [piekarskim](https://github.com/piekarskim) The issue #1 is fixed. 106Using this annotation will result in creating a n-fold cartesian product of parameter values effectively testing each possible combination. 107Since an example is worth a thousand words: 108 109Such annotated test method: 110 111```java 112 113 @Test 114 @CombinedParameters({"a,b", "1,2"}) 115 public void calledWithCartesianProduct(String character, Integer number) { 116 ... 117 } 118``` 119 120Will be called 4 times with parameters: 121 122``` 123 a 1 124 a 2 125 b 1 126 b 2 127``` 128 129 130### Bug fixes and improvements 131 132Thanks to the rest of contributors for lots of bug fixes and improvements: 133 134* [jtbeckha](https://github.com/jtbeckha) 135* [szpak](https://github.com/szpak) 136* [mkordas](https://github.com/mkordas) 137* [davidwiking](https://github.com/davidwiking) 138* [bennetelli](https://github.com/bennetelli) 139 140 141## JUnitParams 1.0.4 release. Release date : 2015-01-23 142 143### Configurable test case name 144New annotation `@TestCaseName` that can be used for test case name configuration: 145 146```java 147 @Test 148 @Parameters({ "1,1", "2,2" }) 149 @TestCaseName("factorial({0}) = {1}") 150 public void custom_names_for_test_case(int argument, int result) { } 151``` 152 153will produce tests with names: 154 155``` 156factorial(1) = 1 157factorial(2) = 2 158``` 159 160Thanks to [Menliat](https://github.com/Menliat) for contribution. 161 162 163### Allow usage of enums as a data source 164 165Parameters annotation now allows passing Enum values as parameters 166 167``` 168@Parameters(source = Fruit.class) 169``` 170 171Thanks to [ukcrpb6](https://github.com/ukcrpb6) for contribution. 172 173 174### Test results filtering fixed 175 176When starting a single test method from within an IDE, the tests results were not shown up properly in the results tab. 177Its fixed now thanks to [jerzykrlk](https://github.com/jerzykrlk) 178 179### Bug fixes and improvements 180 181Thanks to the rest of contributors for lots of bug fixes and improvements: 182 183* [wojtek-szymanski](https://github.com/wojtek-szymanski) 184* [Jacobus2k](https://github.com/Jacobus2k) 185* [justhalf](https://github.com/justhalf) 186* [szpak](https://github.com/szpak) 187* [v-dev](https://github.com/v-dev) 188