use of co.rsk.util.PreflightCheckException in project rskj by rsksmart.
the class StartTest method nodeIsNotRunning_WhenRunNodeAndPreflightCheckFails_ThenNodeRunnerShouldNotRun.
@Test
public void nodeIsNotRunning_WhenRunNodeAndPreflightCheckFails_ThenNodeRunnerShouldNotRun() throws Exception {
Runtime runtime = mock(Runtime.class);
NodeRunner runner = mock(NodeRunner.class);
RskContext ctx = mock(RskContext.class);
doReturn(runner).when(ctx).getNodeRunner();
PreflightChecksUtils preflightChecks = mock(PreflightChecksUtils.class);
doThrow(new PreflightCheckException("test")).when(preflightChecks).runChecks();
try {
Start.runNode(runtime, preflightChecks, ctx);
fail("runNode should throw an exception");
} catch (PreflightCheckException e) {
assertEquals("test", e.getMessage());
verify(preflightChecks, times(1)).runChecks();
verify(runner, never()).run();
verify(runtime, never()).addShutdownHook(any());
}
}
Aggregations