org.sonar.l10n.java.rules.squid.S2925.html Maven / Gradle / Ivy
Using Thread.sleep
in a test is just generally a bad idea.
It creates brittle tests that can fail unpredictably depending on environment ("Passes on my machine!") or load.
Noncompliant Code Example
@Test
public void testDoTheThing(){
MyClass myClass = new MyClass();
myClass.doTheThing();
Thread.sleep(500); // Noncompliant
// assertions...
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy