rootvector2 commented on code in PR #691:
URL:
https://github.com/apache/commons-collections/pull/691#discussion_r3452777032
##########
src/test/java/org/apache/commons/collections4/map/HashedMapTest.java:
##########
@@ -85,4 +90,20 @@ void testInternalState() {
// the threshold has changed due to calling ensureCapacity
assertEquals(96, map.threshold);
}
+
+ /**
+ * A crafted stream can carry a load factor the constructor rejects.
AbstractHashedMap and
+ * AbstractReferenceMap (its own doReadObject override) must reapply that
contract on read.
+ */
+ @ParameterizedTest
+ @ValueSource(floats = {0.0f, -1.0f, Float.NaN})
+ void testDeserializeRejectsInvalidLoadFactor(final float badLoadFactor) {
Review Comment:
good catch. moved the `ReferenceMap` case into `ReferenceMapTest` so each
concrete subclass has its own test method, and `HashedMapTest` now only covers
`HashedMap`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]