kzhunmax opened a new pull request, #1761:
URL: https://github.com/apache/commons-lang/pull/1761

   ### Summary
   
   This PR adds test coverage for `ObjectUtils.wait(Object, Duration)` to 
verify its behavior for valid and invalid Duration values.
   
   ### Changes
   Add a test that verifies `ObjectUtils.wait(lock, Duration.ofMillis(100))` 
waits successfully when the calling thread owns the monitor.
   Verify that a negative `Duration` throws `IllegalArgumentException`.
   Verify that calling wait with `Duration.ZERO` without owning the object's 
monitor throws `IllegalMonitorStateException`.
   Background
   
   A previous attempt to add similar test coverage in PR #1756 resulted in a CI 
failure due to a timing-based assertion:
   
   `ObjectUtilsTest.testWaitDuration:899 expected: <true> but was: <false>`
   
   The previous test relied on timing behavior that proved unreliable in CI 
environments. This version avoids timing-sensitive assertions and instead 
validates the API's contract using deterministic exception checks and a 
successful wait while holding the monitor.


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