Current Code
The same validation pattern appears twice:
- Line 215:
!sleepTime.isZero() && !sleepTime.isNegative()
- Line 566:
!this.sleepTime.isZero() && !this.sleepTime.isNegative()
Proposed Solution
Extract this logic into a helper method isPositiveDuration(Duration) to improve code maintainability and readability.