On Wed, 14 Jul 2021 18:35:15 GMT, Brian Burkhalter <[email protected]> wrote:
> Have you looked into other tests which have implemented Providers?
I have not found any test code containing the word `new FileChannel() {...}` or
`extends FileChannel`, so I apparently there exists no mock of `FileChannel`.
Unfortunately, as long as it is mandatory to copy *all* the tests of
`InputStream/TransferTo` this means that I *must* implement *all* methods of
`FileChannel` (even if they are empty) just for the sake of throwing an
exception after one, two, or three transferred bytes (which, BTW, is not part
of the API but looks like just a personal decision of the original test
author). It is not really helpful that OpenJDK *neither* uses mocking *nor*
lets me reduce the number of tests to the *essential* minimum, as this means, I
wrote approx. 100 LoC for the optimized implementations and now I have to write
approx. 1000 LoC just to perform *exactly the same tests* (to be clear: I have
no problem with testing `content()` which certainly *has* to be tested, but
which does *not* imply writing a `FileChannel` mock).
-------------
PR: https://git.openjdk.java.net/jdk/pull/4263