繁体   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