I'm planning on subclassing certain classes in the Java standard library (my immediate use case is extending java.io.File), and I'd like to be able to test that I haven't broken any contracts of the class. I thought there must be some unit tests for the Java standard library classes available under a permissive licence that I can use, however I can't seem to find any.
This question was asked 4 years ago, but no good answer was given.
It turns out extending java.io.File was a bad idea, so never mind that.
For the standard collections, guava-tests has some excellent interface contract tests. For example, https://github.com/google/guava/blob/master/guava-tests/test/com/google/common/collect/CompactHashSetTest.java uses SetTestSuiteBuilder to test that CompactHashSet complies with Set contracts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With