use of com.hp.octane.integrations.dto.connectivity.TaskProcessingErrorBody in project octane-ci-java-sdk by MicroFocus.
the class TaskingServiceTests method testRunThrowsExceptionAPI.
@Test
public void testRunThrowsExceptionAPI() {
TasksProcessor tasksProcessor = client.getTasksProcessor();
Assert.assertNotNull(tasksProcessor);
OctaneTaskAbridged taskAbridged = dtoFactory.newDTO(OctaneTaskAbridged.class).setId(UUID.randomUUID().toString()).setUrl(OctaneSPEndpointSimulator.getSimulatorUrl() + APIPrefix + "/jobs/job-a/run");
TaskingTestPluginServicesTest.runAPIThrowsException = true;
OctaneResultAbridged resultAbridged = tasksProcessor.execute(taskAbridged);
TaskingTestPluginServicesTest.runAPIThrowsException = false;
runCommonAsserts(resultAbridged, taskAbridged.getId(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
TaskProcessingErrorBody errorBody = dtoFactory.dtoFromJson(resultAbridged.getBody(), TaskProcessingErrorBody.class);
Assert.assertNotNull(errorBody);
Assert.assertNotNull(errorBody.getErrorMessage());
Assert.assertTrue(errorBody.getErrorMessage().contains("runtime exception"));
}
Aggregations