Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Testing 使用提升管S.Redectto进行测试_Testing_Lift - Fatal编程技术网

Testing 使用提升管S.Redectto进行测试

Testing 使用提升管S.Redectto进行测试,testing,lift,Testing,Lift,我目前正在做一个关于liftweb的网络项目。我想为一个有S.redirectTo子句的代码段编写一个测试用例 此重定向在我的测试用例上创建了一个错误。是否有任何方法可以使用S.redirectTo?S.redirectTo抛出ResponseShortcutException以重定向控制流 在您的测试用例中,在对代码段的调用周围放置try/catch以显式处理此异常,类似于: try { ... mySnippet(...) ... } catch { case ex: Res

我目前正在做一个关于liftweb的网络项目。我想为一个有
S.redirectTo
子句的代码段编写一个测试用例


此重定向在我的测试用例上创建了一个错误。是否有任何方法可以使用
S.redirectTo

S.redirectTo抛出ResponseShortcutException以重定向控制流

在您的测试用例中,在对代码段的调用周围放置try/catch以显式处理此异常,类似于:

try {
  ...
  mySnippet(...)
  ...
} catch {
  case ex: ResponseShortcutException => // Assert if this is what you expect
}