/
Weeanoo
/
190
Обзор
Документация
Войти
/
Weeanoo
/
190
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/test/java/lib/BaseTestCase.java
30 строк
960 B
lnoskov
Ex14
31 май 2023, 23:48
31 май 2023, 23:48
257b0d0
Код
Авторство
О чём код?
package lib; import io.restassured.http.Headers; import io.restassured.response.Response; import java.util.Map; import static org.hamcrest.Matchers.hasKey; import static org.junit.jupiter.api.Assertions.assertTrue; public class BaseTestCase { protected String getHeader(Response Response, String name){ Headers headers = Response.getHeaders(); assertTrue(headers.hasHeaderWithName(name), "Response doesn't have header with name " + name); return headers.getValue(name); } protected String getCookie (Response Response, String name){ Map<String, String> cookies = Response.getCookies(); assertTrue(cookies.containsKey(name), "Response doesn't have cookie with name " + name); return cookies.get(name); } protected int getIntFromJson(Response Response, String name){ Response.then().assertThat().body("$", hasKey(name)); return Response.jsonPath().getInt(name); } }