проверить пустой массив для запроса API - PullRequest
0 голосов
/ 27 января 2020

Мой ответ API содержит пустой массив: []

как проверить? Для позитивного сценария ios у меня есть jsonarray и jsonobject. здесь я не уверен, как проверить пустой массив.

public void ValidateEmptyArray() throws JSONException {
    try {
        if(responseJObject.isEmpty()) {
            report.reportPassEvent("Validate cause attribute", "cause value is -"+ responseJObject.getString("cause"));
        } else {
            report.assertFailEvent("Validate cause attribute", "cause value is -"+ responseJObject.getString("cause")+
                    " And expected value is - "+cause);
        }       
    } catch(Exception e) {
            report.assertFailEvent("Validate cause attribute", "cause attribute is not present in the response");
        }
    }
...