]> source.dussan.org Git - sonarqube.git/commitdiff
Fix Flaky test
authorDavid Gageot <david@gageot.net>
Mon, 6 Jul 2015 15:34:50 +0000 (17:34 +0200)
committerDavid Gageot <david@gageot.net>
Mon, 6 Jul 2015 15:34:50 +0000 (17:34 +0200)
server/sonar-process/src/test/java/org/sonar/process/StopWatcherTest.java

index e78d1c17b3eb961b4a6e847f8e7371582510031c..038aff4b046846651519ec04ad1fdbd9678bd0a6 100644 (file)
  */
 package org.sonar.process;
 
-import java.util.concurrent.TimeUnit;
-import org.junit.Rule;
 import org.junit.Test;
-import org.junit.rules.Timeout;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
@@ -30,11 +27,7 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 public class StopWatcherTest {
-
-  @Rule
-  public Timeout timeout = new Timeout(1000, TimeUnit.MILLISECONDS);
-
-  @Test
+  @Test(timeout = 1000)
   public void stop_if_receive_command() throws InterruptedException {
     ProcessCommands commands = mock(ProcessCommands.class);
     when(commands.askedForStop()).thenReturn(false, true);
@@ -47,7 +40,7 @@ public class StopWatcherTest {
     verify(stoppable).stopAsync();
   }
 
-  @Test
+  @Test(timeout = 5000)
   public void stop_watching_on_interruption() throws InterruptedException {
     ProcessCommands commands = mock(ProcessCommands.class);
     when(commands.askedForStop()).thenReturn(false);