Skip to content

Commit

Permalink
Update CHANGELOG with the new context aware values provider
Browse files Browse the repository at this point in the history
  • Loading branch information
nymanjens committed Jan 17, 2024
1 parent e312198 commit 25cf9ff
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
## 1.15

- Add context aware version of [`TestParameterValuesProvider`](
https://google.github.io/TestParameterInjector/docs/latest/com/google/testing/junit/testparameterinjector/TestParameterValuesProvider.html).
It is the same as the old [`TestParameter.TestParameterValuesProvider`](
https://google.github.io/TestParameterInjector/docs/latest/com/google/testing/junit/testparameterinjector/TestParameter.TestParameterValuesProvider.html),
except that `provideValues()` was changed to `provideValues(Context)` where
[`Context`](
https://google.github.io/TestParameterInjector/docs/latest/com/google/testing/junit/testparameterinjector/TestParameterValuesProvider.Context.html)
contains the test class and the other annotations. This allows for more generic
providers that take into account custom annotations with extra data, or the
implementation of abstract methods on a base test class.

Example usage:

```java
import com.google.testing.junit.testparameterinjector.TestParameterValuesProvider;

private static final class MyProvider extends TestParameterValuesProvider {
@Override
public List<?> provideValues(Context context) throws Exception {
var testInstance = context.testClass().getDeclaredConstructor().newInstance();
var fooList = ((MyBaseTestClass) testInstance).getFooList();
// ...

// OR

var fooList = context.getOtherAnnotation(MyCustomAnnotation.class).fooList();
// ...
}
}
```

- Fixed some theoretical non-determinism that could arise from Java reflection
methods

## 1.14

- Fixed multiple constructors error when this library is used with Powermock.
Expand Down

0 comments on commit 25cf9ff

Please sign in to comment.