无法使用接受Hashmap作为另一个类中的参数的函数

时间:2019-04-20 15:54:00

标签: java automation rest-assured

我有2个课程

class APIDriver 

    protected RequestSpecification generateCommonReqSpecJsonWithQueryParams(Map<String, Object> params)
    {
        return given().accept(ContentType.JSON).queryParams(params);
    }
public class Demo extends APIDriver{
    @Test (groups = "sanity", description = "first API test")
    public void givenUserDoesNotExists_whenUserInfoIsRetrieved_then404IsReceived()
    throws Exception {
        ExtentTestManager.getTest().log(LogStatus.INFO, "Test started");
        String name = RandomStringUtils.randomAlphabetic( 8 );
        String url = "https://api.github.com/users/" + name;
        RequestSpecification spec = generateCommonReqSpecJsonWithQueryParams(//);
        Response resp = RestOperationUtils.get(url, spec, null);
        APIResponse apiResp = new APIResponse(resp);
        assert apiResp.getStatusCode()==404;

我该如何在请求中传递以下参数及其值?

param1
(key--->1234)
param2
(loc--->34.56)

0 个答案:

没有答案