diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-05-09 11:17:15 -0500 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-06-03 20:21:22 +0200 |
commit | c3f0b65a4dbf26dc8f1071317a87b3c297cf8702 (patch) | |
tree | dae0b35c2c0bd4c4ca6f36189b097babd8aa96b4 /server/sonar-process/src/test | |
parent | 37fd266fb3d3fd1965580e1a8038f3ea9fe53b8a (diff) | |
download | sonarqube-c3f0b65a4dbf26dc8f1071317a87b3c297cf8702.tar.gz sonarqube-c3f0b65a4dbf26dc8f1071317a87b3c297cf8702.zip |
SONAR-12043 Minor refactor
Diffstat (limited to 'server/sonar-process/src/test')
-rw-r--r-- | server/sonar-process/src/test/java/org/sonar/process/StopWatcherTest.java (renamed from server/sonar-process/src/test/java/org/sonar/process/AbstractStopWatcherTest.java) | 8 | ||||
-rw-r--r-- | server/sonar-process/src/test/java/org/sonar/process/test/StandardProcess.java | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/server/sonar-process/src/test/java/org/sonar/process/AbstractStopWatcherTest.java b/server/sonar-process/src/test/java/org/sonar/process/StopWatcherTest.java index 8fbc9b2cefd..79561fdf967 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/AbstractStopWatcherTest.java +++ b/server/sonar-process/src/test/java/org/sonar/process/StopWatcherTest.java @@ -32,7 +32,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class AbstractStopWatcherTest { +public class StopWatcherTest { @Rule public TestRule safeguardTimeout = new DisableOnDebug(Timeout.seconds(60)); @@ -44,8 +44,7 @@ public class AbstractStopWatcherTest { when(commands.askedForHardStop()).thenReturn(false, true); Stoppable stoppable = mock(Stoppable.class); - AbstractStopWatcher underTest = new AbstractStopWatcher("TheThreadName", - stoppable::hardStopAsync, commands::askedForHardStop, 1L) {}; + StopWatcher underTest = new StopWatcher("TheThreadName", stoppable::hardStopAsync, commands::askedForHardStop, 1L); underTest.start(); while (underTest.isAlive()) { @@ -61,8 +60,7 @@ public class AbstractStopWatcherTest { when(commands.askedForHardStop()).thenReturn(false); Stoppable stoppable = mock(Stoppable.class); - AbstractStopWatcher underTest = new AbstractStopWatcher("TheThreadName", - stoppable::hardStopAsync, commands::askedForHardStop, 1L) {}; + StopWatcher underTest = new StopWatcher("TheThreadName", stoppable::hardStopAsync, commands::askedForHardStop, 1L); underTest.start(); underTest.interrupt(); diff --git a/server/sonar-process/src/test/java/org/sonar/process/test/StandardProcess.java b/server/sonar-process/src/test/java/org/sonar/process/test/StandardProcess.java index 3f449d635fe..e360cd03605 100644 --- a/server/sonar-process/src/test/java/org/sonar/process/test/StandardProcess.java +++ b/server/sonar-process/src/test/java/org/sonar/process/test/StandardProcess.java @@ -36,11 +36,9 @@ public class StandardProcess implements Monitored { @Override public void run() { try { - while (true) { - Thread.sleep(100L); - } + Thread.sleep(Long.MAX_VALUE); } catch (InterruptedException e) { - Thread.currentThread().interrupt(); + interrupt(); } } }; |