diff --git a/impl/http/src/test/java/io/serverlessworkflow/impl/HTTPWorkflowDefinitionTest.java b/impl/http/src/test/java/io/serverlessworkflow/impl/HTTPWorkflowDefinitionTest.java index d9d2663a..c6447141 100644 --- a/impl/http/src/test/java/io/serverlessworkflow/impl/HTTPWorkflowDefinitionTest.java +++ b/impl/http/src/test/java/io/serverlessworkflow/impl/HTTPWorkflowDefinitionTest.java @@ -62,12 +62,16 @@ void testWrongSchema(String fileName) { .hasMessageContaining("There are JsonSchema validation errors"); } + private static boolean httpCondition(Object obj) { + Map map = (Map) obj; + return map.containsKey("photoUrls") || map.containsKey("petId"); + } + private static Stream provideParameters() { Map petInput = Map.of("petId", 10); Map starTrekInput = Map.of("uid", "MOMA0000092393"); Condition petCondition = - new Condition<>( - o -> ((Map) o).containsKey("photoUrls"), "callHttpCondition"); + new Condition<>(HTTPWorkflowDefinitionTest::httpCondition, "callHttpCondition"); Condition starTrekCondition = new Condition<>( o -> diff --git a/impl/http/src/test/resources/call-http-endpoint-interpolation.yaml b/impl/http/src/test/resources/call-http-endpoint-interpolation.yaml index 5c1239f0..43ba4988 100644 --- a/impl/http/src/test/resources/call-http-endpoint-interpolation.yaml +++ b/impl/http/src/test/resources/call-http-endpoint-interpolation.yaml @@ -4,10 +4,17 @@ document: name: call-http-shorthand-endpoint version: '0.1.0' do: - - getPet: - call: http - with: - headers: - content-type: application/json - method: get - endpoint: ${ "https://petstore.swagger.io/v2/pet/\(.petId)" } \ No newline at end of file + - tryGetPet: + try: + - getPet: + call: http + with: + headers: + content-type: application/json + method: get + endpoint: ${ "https://petstore.swagger.io/v2/pet/\(.petId)" } + catch: + errors: + with: + type: https://serverlessworkflow.io/spec/1.0.0/errors/communication + status: 404 \ No newline at end of file