commons-collections icon indicating copy to clipboard operation
commons-collections copied to clipboard

Added missing functionality unit test for MultiKeyMap.put, multiKeyMap, removeAll, CircularFifoQueue.add, isEmpty

Open Partha-SUST16 opened this issue 7 months ago • 0 comments

Hi,

I’ve added unit tests for certain behaviors in the CircularFifoQueue and MultiKeyMap classes that are described in the Javadoc but were not explicitly tested before. These tests do not increase code coverage, as the relevant lines are already executed by other tests, but they help make the intended behavior more explicit and well-documented through testing.

For CircularFifoQueue:

  • add always returns true, even if an element is discarded.
  • isEmpty returns a boolean indicating whether the queue is empty.

For MultiKeyMap:

  • put throws a ClassCastException if the key is not a MultiKey.
  • multiKeyMap throws a NullPointerException when the provided map is null.
  • removeAll returns a boolean to indicate if any entries were removed.

I added separate test methods for each of these behaviors in their respective test classes. Even though they don’t increase coverage metrics, I believe these tests are useful for improving clarity, helping future maintainers understand the method contracts better, and guarding against subtle regressions.

Thanks!

Partha-SUST16 avatar Jun 08 '25 19:06 Partha-SUST16