Skip to content

Commit

Permalink
Remove sleeping from LightyModuleTest
Browse files Browse the repository at this point in the history
Remove sleeping from tests. Instead use dedicated shutdown methods
which are designed to accept timeouts.

JIRA: LIGHTY-299
Signed-off-by: Ivan Hrasko <[email protected]>
  • Loading branch information
ihrasko committed Sep 12, 2024
1 parent 5721f78 commit 6d3c1ae
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ public void testStartStop_whenAlreadyStartedStopped() throws Exception {
Assert.fail("Init timed out.", e);
}
Mockito.verify(executorService, Mockito.times(1)).execute(Mockito.any());
this.moduleUnderTest.shutdown();
this.moduleUnderTest.shutdown(SLEEP_AFTER_SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS);
Mockito.verify(executorService, Mockito.times(2)).execute(Mockito.any());
Thread.sleep(SLEEP_AFTER_SHUTDOWN_TIMEOUT);
this.moduleUnderTest.shutdown();
this.moduleUnderTest.shutdown(SLEEP_AFTER_SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS);
Mockito.verify(executorService, Mockito.times(2)).execute(Mockito.any());
}

Expand Down

0 comments on commit 6d3c1ae

Please sign in to comment.