Search in sources :

Example 1 with TaskProcessingErrorBody

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"));
}
Also used : OctaneResultAbridged(com.hp.octane.integrations.dto.connectivity.OctaneResultAbridged) OctaneTaskAbridged(com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged) TaskProcessingErrorBody(com.hp.octane.integrations.dto.connectivity.TaskProcessingErrorBody) Test(org.junit.Test)

Aggregations

OctaneResultAbridged (com.hp.octane.integrations.dto.connectivity.OctaneResultAbridged)1 OctaneTaskAbridged (com.hp.octane.integrations.dto.connectivity.OctaneTaskAbridged)1 TaskProcessingErrorBody (com.hp.octane.integrations.dto.connectivity.TaskProcessingErrorBody)1 Test (org.junit.Test)1