Skip to content

Commit

Permalink
[Fix #3475] Adding end metadata usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Apr 30, 2024
1 parent 1d0004e commit e783970
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"id": "errorWithMetadata",
"version": "1.0",
"name": "Workflow Error example with metadata",
"description": "An example of how to abort a workflow with error given a condition",
"start": "checkEven",
"states": [
{
"name": "checkEven",
"type": "operation",
"actions": [],
"end" : true,
"metadata": {
"errorMessage": "if .number % 2 != 0 then \"Is Odd number!!!!\" else null end"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,25 @@ public void testErrorRest() {
.statusCode(201)
.body("workflowdata.numberType", is("even"));
}

@Test
public void testErrorWithMetadata() {
given()
.contentType(ContentType.JSON)
.accept(ContentType.JSON)
.body("{\"number\" : 12342}")
.when()
.post("/errorWithMetadata")
.then()
.statusCode(201);

given()
.contentType(ContentType.JSON)
.accept(ContentType.JSON)
.body("{\"number\" : 12341}")
.when()
.post("/errorWithMetadata")
.then()
.statusCode(400);
}
}

0 comments on commit e783970

Please sign in to comment.