use of com.dyngr.Polling in project cloudbreak by hortonworks.
the class SdxWaitTaskServiceTest method testWaitFor.
@Test
void testWaitFor() {
try (MockedStatic<Polling> polling = mockStatic(Polling.class)) {
SdxWaitTask<?> sdxWaitTask = new TestWaitTask(new SdxCluster(), POLLING_CONFIG, "My Sdx task");
setupPolling(polling);
underTest.waitFor(sdxWaitTask);
verify(pollingOptions).stopAfterDelay(DURATION, DURATION_TIME_UNIT);
verify(pollingOptions).stopIfException(Boolean.TRUE);
verify(pollingOptions).run(sdxWaitTask);
}
}
use of com.dyngr.Polling in project cloudbreak by hortonworks.
the class SdxWaitTaskServiceTest method testWaitForWithPollerException.
@Test
void testWaitForWithPollerException() {
try (MockedStatic<Polling> polling = mockStatic(Polling.class)) {
SdxWaitTask<?> sdxWaitTask = new TestWaitTask(new SdxCluster(), POLLING_CONFIG, "My Sdx task");
setupPolling(polling);
doThrow(new PollerException()).when(pollingOptions).run(sdxWaitTask);
Assertions.assertThrows(SdxWaitException.class, () -> {
underTest.waitFor(sdxWaitTask);
});
verify(pollingOptions).stopAfterDelay(DURATION, DURATION_TIME_UNIT);
verify(pollingOptions).stopIfException(Boolean.TRUE);
verify(pollingOptions).run(sdxWaitTask);
}
}
Aggregations