问题描述
我正在使用基于黄瓜的Framework探索放心(Java)。编写了一种用于处理查询参数的方法,它期望如下的
protected Response **getByQueryParams**(final String url,Map<String,?> queryParams) {
setRootApiUrl();
return given()
.queryParams(queryParams)
.contentType(ContentType.JSON)
.accept(ContentType.JSON).get(url)
.thenReturn();
}
我的要求。终点是:** http:// localHost:8088 / state-names?countryCode = IND **
我的黄瓜步骤与以下相同-
Given I perform Get operation for "/state-names" with below query params
|countryCode|
|IND |
我的Step Def代码:使用上面的(getByQueryParams)方法>
@Given("I perform Get operation for {string} with below query params")
public void getAllStatesWithCountryCode(String uri,String> table) {
var queryParMap=new HashMap<>();
for (Map.Entry<String,String> data : table.entrySet()) {
queryParMap.put(data.getKey(),data.getValue());
}
response = getByQueryParams(uri,queryParMap);
}
这是引发错误-必需的类型:Map
错误似乎很明显,但是我在Java中不是很好,因此通过避免上述错误,在我的场景中无法理解如何将此方法与已定义的Map
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)