RestAssured-> QueryParameters的错误处理

问题描述

//我正在使用RestAssured和Java。

///我想验证我的1号服务是否失败并且无法获取帐号,我该如何使用2号的硬//编码帐号?有人可以帮助我解决哪种错误情况或策略吗?采用? //基本上,如果1号失败,则用户2号。

// No 1 Getting the account number from other class by calling another api


 acct= otherclass.getaccountNumber();
    queryParamerters.put("accountnumber",acct);

// No 2 Hard coded account number 
 queryParamerters.put("accountnumber","123456");
    

解决方法

创建一个标志,如果No1没有失败则将其设置为0,如果标志为0,则使用No2