@Test public void testCreateWorkflowShouldReturnSavedWorkflow() { given() .pathParam("bucketId", bucket.getId()) .queryParam("layout", layoutMetadata) .multiPart(IntegrationTestUtil.getWorkflowFile("workflow.xml")) .when() .post(WORKFLOWS_RESOURCE) .then() .assertThat() .statusCode(HttpStatus.SC_CREATED) .body("bucket_id", is(bucket.getId().intValue())) .body("id", is(2)) .body("name", is("Valid Workflow")) .body("project_name", is("Project Name")) .body("revision_id", is(1)) .body("generic_information", hasSize(2)) .body("generic_information[0].key", is("genericInfo1")) .body("generic_information[0].value", is("genericInfo1Value")) .body("generic_information[1].key", is("genericInfo2")) .body("generic_information[1].value", is("genericInfo2Value")) .body("variables", hasSize(2)) .body("variables[0].key", is("var1")) .body("variables[0].value", is("var1Value")) .body("variables[1].key", is("var2")) .body("variables[1].value", is("var2Value")) .body("layout", is(layoutMetadata)); }
@Test public void testCreateWorkflowShouldReturnNotFoundIfNonExistingBucketId() { given() .pathParam("bucketId", 42) .multiPart(IntegrationTestUtil.getWorkflowFile("workflow.xml")) .when() .post(WORKFLOWS_RESOURCE) .then() .assertThat() .statusCode(HttpStatus.SC_NOT_FOUND); }