This is small refactoring
There are bunch of places where use deprecated methods.
These changes fix this issue.
## General checklist
<!-- Please double-check the following points and mark them like this:
[X] -->
- [x] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [x] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [x] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
Hi! Noticed _almost all_ tests used AssertJ, but in some cases JUnit was
still used. In addition to that some tests don't use the most expressive
assertions. Figured clean that up such that you get better assertions if
any tests were to fail. Compare for instance
```diff
- assertThat(document.metadata().asMap().size()).isEqualTo(4);
+ assertThat(document.metadata().asMap()).hasSize(4);
```
The first one will print expected 5 to be equal to 4, whereas the second
one shows the contents of the map involved.
Being consistent with your test library also stops bad patterns from
repeating accidentally through copy-and-paste. If you want to enforce
these best practices through an automated pull request check that's also
an option. Let me know if you'd want that as well. Hope that helps!
Fix#438
Warning: this requires to upgrade Jackson to its latest version
(`2.16.1`) so there might be an impact on other modules using it, like
Elasticsearch.