如何mock n.hutool.http.HttpRequest调用?
String result = httpRequest .post("https://example.com")
.timeout(5000)
.contentType("multipart/form-data")
.header("header1", "value1")
.form("param1", "value1")
.execute()
.body();
回答:
做好分层,不 mock hutool,mock 掉 hutool 所在的这一层
比如 UserService -> UserClient -> Hutool
mock 掉 UserClient 就行了
以上是 如何mock n.hutool.http.HttpRequest调用? 的全部内容, 来源链接: utcz.com/p/945236.html