java:S2925 should check TimeUnit.sleep()

The rule java:S2925 checks that Thread.sleep() is not used in tests. The rule should additionally check for usages of TimeUnit.sleep() which converts the TimeUnit's value to milliseconds and forwards to Thread.sleep().
Example:

java.util.concurrent.TimeUnit.SECONDS.sleep(1);

Equivalent to:

Thread.sleep(1000);

Hello @oliver

Indeed, it makes sense to support it aswell. Ticket created: SONARJAVA-3838.

Thanks for the suggestion and have a nice day.
Quentin

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.