shoothzj opened a new pull request, #4332:
URL: https://github.com/apache/bookkeeper/pull/4332

   Fix #2077 
   
   ### Motivation
   
   In the existing tests for `ConcurrentLongHashSet` and 
`ConcurrentLongLongHashMap`, the method `Math.abs(random.nextLong())` is used 
to generate keys. However, `Math.abs` can return a negative number if 
`Long.MIN_VALUE` is generated, which is problematic for tests that assume 
non-negative keys. Additionally, the assertions in the tests are using the 
older JUnit 4 style, which is less readable and not as flexible as JUnit 5.
   
   ### Changes
   
   1. **Key Generation Fix**: Replaced `Math.abs(random.nextLong())` with 
`ThreadLocalRandom.current().nextLong(Long.MAX_VALUE)` to ensure that all 
generated keys are non-negative.
   2. **Assertion Updates**: Updated all assertions in the 
`ConcurrentLongHashSetTest` and `ConcurrentLongLongHashMapTest` to use JUnit 5 
style. This includes using `assertEquals`, `assertTrue`, `assertFalse`, and 
`assertNull` for better readability and consistency.


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

Reply via email to