Commit 06b1bdcd authored by 吕雯燕's avatar 吕雯燕

lv

parent 9ff1e122
......@@ -107,40 +107,32 @@ public class 兑吧老实物_兑换流程测试_ExchangeTest extends CheckTemple
return result;
}
//实物兑换积分不足
//实物兑换积分不足实物兑换积分不足
@Test(description = "实物兑换积分不足")
public void 积分不足() throws Exception {
String message = "";
//活动详情页
Response response = mobileService.detail(authorization.dafuwengLogin(3086), "28515");
Map<String, String> map = authorization.dafuwengLogin(3086);
Assert.assertEquals(String.valueOf(response.getStatusCode()), "200", "活动详情页请求异常");
//实物兑换
response = couponExchangeService.objectExchange(map, "167141", "28515", "null", "yrJRr7Cddp2YeQd", "null");
response.prettyPrint();
//校验兑换成功
// Assert.assertEquals(response.jsonPath().getString("success"),"true");
//获取orderId
String orderId = response.jsonPath().getString("orderId");
//获取兑换结果
response = mobileService.orderAmbStatusQuery(3086,orderId);
response.prettyPrint();
String message = response.jsonPath().getString("data.message");
int i = 10;
//异步接口,直到兑换成功
while (i > 0 && "兑换正在处理中...".equals(message)) {
Thread.sleep(1000);
response = mobileService.orderAmbStatusQuery(3086,orderId);
//无法兑换,直接抛出
try{
response = couponExchangeService.objectExchange(map, "167141", "28515", "null", "yrJRr7Cddp2YeQd", "null");
response.prettyPrint();
message = response.jsonPath().getString("data.message");
i--;
}catch (Exception e){
message = e.toString();
}
logger.info(message);
//校验messaga字段返回值
String message2 = response.jsonPath().getString("data.message");
Assert.assertEquals(message2,"兑换失败,用户积分余额不足","message字段校验失败-期望是积分不足");
Assert.assertTrue(message.contains("\"success\":false"),"校验message失败");
Assert.assertTrue(message.contains("\"message\":\"您的积分不足\""),"校验message失败"); //这个提示很奇怪
logger.info("校验实物兑换积分不足成功");
// authorization.dafuwengLogin(2720,true);
}
//实物兑换限制消费
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment