下面是我的休息方法
public String OrdersSuspend(String ordersSuspendJson) {
Response respOrder = ctx.post(ORDERSSUSPEND,ordersSuspendJson).then().
statusCode(200).extract().response();
return respOrder.getBody().asString();
}
下面是我的步骤定义
orderResponse.ifPresent(o -> {
orderSuspendResponse = restCalls.OrdersSuspend("[" + o.toJson() + "]");
});
orderResponse.ifPresent(o -> {
orderResponse = Optional.ofNullable(restCalls.restgetOrder(o.getId()));
});
当请求有效负载为
时,以上代码可以很好地工作[
{id: 16042, version: 1}
]
0: {id: 16042, version: 1}
有1个以上的对象时不起作用
[
{id: 16042, version: 3},
{id: 16043, version: 0}
]
0: {id: 16042, version: 3}
1: {id: 16043, version: 0}