use of io.automatiko.engine.api.event.DataEvent in project automatiko-engine by automatiko-io.
the class VerificationTest method testProcessAsyncCallFailure.
@Test
public void testProcessAsyncCallFailure() {
String addPayload = "{\"name\" : null}";
given().contentType(ContentType.JSON).accept(ContentType.JSON).body(addPayload).when().post("/async").then().statusCode(200).body("id", notNullValue(), "name", nullValue());
List<DataEvent<?>> received = publisher.events();
assertEquals(2, received.size());
ProcessInstanceDataEvent piEvent = (ProcessInstanceDataEvent) received.stream().filter(pi -> ((ProcessInstanceDataEvent) pi).getData().getState().equals(ProcessInstance.STATE_COMPLETED)).findFirst().get();
assertEquals(null, piEvent.getData().getVariables().get("name"));
given().accept(ContentType.JSON).when().get("/async").then().statusCode(200).body("$.size()", is(0));
}
Aggregations