00sense commented on code in PR #3786:
URL: https://github.com/apache/fory/pull/3786#discussion_r3468952604


##########
java/fory-core/src/test/java/org/apache/fory/serializer/collection/CollectionSerializersTest.java:
##########
@@ -1153,6 +1153,13 @@ public void testSerializeJavaBlockingQueue() {
       assertEquals(new ArrayList<>(deserialized), new ArrayList<>(queue));
       assertEquals(deserialized.remainingCapacity() + deserialized.size(), 3);
     }
+    {
+      LinkedBlockingQueue<Integer> queue = new LinkedBlockingQueue<>();
+      queue.add(1);
+      queue.add(2);
+      LinkedBlockingQueue<Integer> deserialized = serDe(fory, queue);
+      assertEquals(new ArrayList<>(deserialized), new ArrayList<>(queue));
+    }

Review Comment:
   For unbounded LinkedBlockingQueue, remainingCapacity() returns 
Integer.MAX_VALUE regardless of size(), so remainingCapacity() + size() 
overflows. The bounded assertion above works because remainingCapacity = 
capacity - size there. I'd drop that line or use 
assertEquals(Integer.MAX_VALUE, deserialized.remainingCapacity()) if we want a 
capacity check.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to