使用Rest Assured Get类型返回400状态代码的测试REST API

时间:2019-07-10 12:30:03

标签: java junit rest-assured

我可以通过邮递员客户端测试我的REST API,它可以给我预期的响应。但是,当我尝试通过junit进行测试时,它给出了400个状态代码

根据有效内容,内容类型为application / json

final static String ROOT_URI = "http://localhost:7000/employees";

@Test
public void simple_get_test() {
    Response response = get(ROOT_URI + "/list?emp=100");
}

我错过了什么

1 个答案:

答案 0 :(得分:0)

尝试使用RestAssured.port = 7000设置端口,并将其从URI中删除。如果您在代码之外还发布了响应消息,将很有用。