• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## 1.16
2
3- Deprecated [`TestParameter.TestParameterValuesProvider`](
4  https://google.github.io/TestParameterInjector/docs/latest/com/google/testing/junit/testparameterinjector/TestParameter.TestParameterValuesProvider.html)
5  in favor of its newer version [`TestParameterValuesProvider`](
6  https://google.github.io/TestParameterInjector/docs/latest/com/google/testing/junit/testparameterinjector/TestParameterValuesProvider.html).
7
8## 1.15
9
10- Add context aware version of [`TestParameterValuesProvider`](
11  https://google.github.io/TestParameterInjector/docs/latest/com/google/testing/junit/testparameterinjector/TestParameterValuesProvider.html).
12  It is the same as the old [`TestParameter.TestParameterValuesProvider`](
13  https://google.github.io/TestParameterInjector/docs/latest/com/google/testing/junit/testparameterinjector/TestParameter.TestParameterValuesProvider.html),
14  except that `provideValues()` was changed to `provideValues(Context)` where
15  [`Context`](
16  https://google.github.io/TestParameterInjector/docs/latest/com/google/testing/junit/testparameterinjector/TestParameterValuesProvider.Context.html)
17  contains the test class and the other annotations. This allows for more generic
18  providers that take into account custom annotations with extra data, or the
19  implementation of abstract methods on a base test class.
20
21  Example usage:
22
23```java
24import com.google.testing.junit.testparameterinjector.TestParameterValuesProvider;
25
26private static final class MyProvider extends TestParameterValuesProvider {
27  @Override
28  public List<?> provideValues(Context context) throws Exception {
29    var testInstance = context.testClass().getDeclaredConstructor().newInstance();
30    var fooList = ((MyBaseTestClass) testInstance).getFooList();
31    // ...
32
33    // OR
34
35    var fooList = context.getOtherAnnotation(MyCustomAnnotation.class).fooList();
36    // ...
37  }
38}
39```
40
41- Fixed some theoretical non-determinism that could arise from Java reflection
42  methods
43
44## 1.14
45
46- Fixed multiple constructors error when this library is used with Powermock.
47  See https://github.com/google/TestParameterInjector/issues/40.
48
49## 1.13
50
51- Add support for setting a custom name for a `@TestParameter` value given via a provider:
52
53```java
54private static final class FruitProvider implements TestParameterValuesProvider {
55  @Override
56  public List<?> provideValues() {
57    return ImmutableList.of(
58        value(new Apple()).withName("apple"),
59        value(new Banana()).withName("banana"));
60  }
61}
62```
63
64- Add support for `BigInteger` and `UnsignedLong`
65- JUnit4: Fix for interrupted test cases causing random failures with thread
66  reuse (porting [the earlier fix in
67  JUnit4](https://github.com/junit-team/junit4/issues/1365))
68
69## 1.12
70
71- Tweak to the test name generation: Show the parameter name if its value is potentially
72  ambiguous (e.g. null, "" or "123").
73- Made `TestParametersValues.name()` optional. If missing, a name will be generated.
74
75## 1.11
76
77- Replaced deprecated call to org.yaml.snakeyaml.constructor.SafeConstructor
78
79## 1.10
80
81- Removed dependency on `protobuf-javalite` (see
82  [issue #24](https://github.com/google/TestParameterInjector/issues/24))
83
84## 1.9
85
86- Bugfix: Support explicit ordering by the JUnit4 `@Rule`. For example: `@Rule(ordering=3)`.
87- Potential test name change: Test names are no longer dependent on the locale of the machine
88  running it (e.g. doubles with integer values are always formatted with a trailing `.0`)
89
90## 1.8
91
92- Add support for JUnit5 (Jupiter)
93
94## 1.7
95
96- Remove `TestParameterInjector` support for `org.junit.runners.Parameterized`,
97  which was undocumented and thus unlikely to be used.
98
99## 1.6
100
101- Bugfixes
102- Better documentation
103
104## 1.5
105
106- `@TestParameters` can now also be used as a repeated annotation:
107
108```java
109// Newly added and recommended for new code
110@Test
111@TestParameters("{age: 17, expectIsAdult: false}")
112@TestParameters("{age: 22, expectIsAdult: true}")
113public void withRepeatedAnnotation(int age, boolean expectIsAdult){...}
114
115// The old way of using @TestParameters is still supported
116@Test
117@TestParameters({
118    "{age: 17, expectIsAdult: false}",
119    "{age: 22, expectIsAdult: true}",
120})
121public void withSingleAnnotation(int age, boolean expectIsAdult){...}
122```
123
124- `@TestParameters` supports setting a custom test name:
125
126```java
127@Test
128@TestParameters(customName = "teenager", value = "{age: 17, expectIsAdult: false}")
129@TestParameters(customName = "young adult", value = "{age: 22, expectIsAdult: true}")
130public void personIsAdult(int age, boolean expectIsAdult){...}
131```
132
133- Test names with very long parameter strings are abbreviated differentily: In
134  some cases, more characters are allowed.
135
136## 1.4
137
138- Bugfix: Run test methods declared in a base class (instead of throwing an
139  exception)
140- Test names with very long parameter strings are now abbreviated with a snippet
141  of the shortened parameter
142- Duplicate test names are given a suffix for deduplication
143- Replaced dependency on `protobuf-java` by a dependency on `protobuf-javalite`
144
145## 1.3
146
147- Treat 'null' as a magic string that results in a null value
148
149## 1.2
150
151- Don't use the parameter name if it's not explicitly provided by the compiler
152- Add support for older Android SDK versions by removing the dependency on
153  `j.l.r.Parameter`. The minimum Android SDK version is now 24.
154
155## 1.1
156
157- Add support for `ByteString` and `byte[]`
158