2023년 05월 17일

@VERO
Created Date · 2023년 05월 17일 04:05
Last Updated Date · 2023년 05월 17일 04:05

LOG

배운 것

  • RestAssuredas를 사용할 때 주의할 점 : as 내부에 DTO가 존재하고 DTO의 매개변수가 1개라면 꼭 기본 생성자가 필요하다. (Response용으로 사용되더라도!) 일관성을 위해 모든 DTO에 기본 생성자를 달아주자.
ExtractableResponse<Response> response = RestAssured  
        .given().log().all()  
        .accept(MediaType.APPLICATION_JSON_VALUE)  
        .when().get("/lines/{노선_ID}", 노선_ID)  
        .then().log().all()  
        .extract();  
        
LineResponse lineResponse = response.as(LineResponse.class);