簡體   English   中英

io.restassured.internal.http.HttpResponseException:未找到

[英]io.restassured.internal.http.HttpResponseException: Not Found

我是一名新的 Java 學習者,期待發展自動化測試工程技能。 我目前正在為此目的舉辦一個新兵訓練營。 我想用你的幫助解決一個問題。 我們正在嘗試發送這樣的負面情況請求;

When 
  I send a GET Request to the URL https://restful-booker.herokuapp.com/booking/1001
Then 
  HTTP Status code should be 404
And  
  Status Line should be HTTP/1.1 404 Not Found

雖然我們和我們的導師有相同的代碼;

import org.junit.Test;
import static io.restassured.RestAssured.*;
import io.restassured.http.ContentType;
import io.restassured.response.Response;

public class GetRequest02 {
    @Test
    public void get01() {
    String url = "https://restful-booker.herokuapp.com/booking/1001";
    Response response = given().
                                accept(ContentType.JSON).
                            when().
                                get(url);
        response.prettyPrint();
        response.
                then().
                assertThat().
                statusCode(404).
                statusLine("HTTP/1.1 404 Not Found");
    }
}

他變綠了,但我們中的一些人被這條信息變紅了;

io.restassured.internal.http.HttpResponseException: Not Found

我們找不到解決方案? 有人可以幫助我們嗎?

感謝您的關注...

在 pom.xml 上,在 `

<maven.compiler.target>11</maven.compiler.target>

` 類型

 <argLine>-Duser.language=en</argLine>

         and retry.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM