Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
My motivation for making this change is that [`ByteBuffer` is becoming `sealed`](https://download.java.net/java/early_access/loom/docs/api/java.base/java/nio/ByteBuffer.html) in new versions of Java. This makes it impossible for Mockito's _current_ default mockmaker to mock it. That said, Mockito will likely [switch its default mockmaker](mockito/mockito#2589) to an alternative that _is_ able to mock `sealed` classes. However, there are downside to that, such as [slower performance](mockito/mockito#2589 (comment)), so it's probably better to leave our options open by avoiding mocking at all. And in this case, it's equally easy to use real objects. As a bonus, I think that real objects makes the code a little easier to follow: Before, we created mocks that the code under test never interacted with in any way. (The code just passed them through to a delegate.) When I first read the tests, I was confused, since I assumed that the mock we were creating was the same mock that we then passed to `verify` at the end of the method. That turned out not to be the case. Given that, I figured I'd switch not only to a real `ByteBuffer` but also to a real `OutputStream`.
- Loading branch information