问题描述
当数据可用时,我的Foo服务将返回响应。 Foo服务未从下游接收数据,则它将返回404。在测试用例以下,当接收404时工作正常。 Foo Service返回测试用例下方的数据失败
'groovyx.net.http.HttpResponseException'类型的预期异常, 但没有引发异常
我想在同一个测试用例中处理这两种情况。
def "check foo service in real time"() {
setup:
String path = "/v1/foo"
when:
HttpResponseDecorator response = httpGet(path)
then:
HttpResponseException e = thrown()
if(response){
assert response.data =="bar"
}else {
assert e.statusCode == HttpStatus.NOT_FOUND.value()
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)