如何在Java中捕获cucumber中的多行文本

ZZZ*_*ZZZ 3 java cucumber

我有一个 Java 黄瓜测试,其中包含以下测试用例:

.....
And the returned information should be
  """
  This is the first line of my text
  This is the second line of my text
  This is the third line of my text
  """
Run Code Online (Sandbox Code Playgroud)

我写的步骤def是:

@Then("^the returned information should be (.*)$")
Run Code Online (Sandbox Code Playgroud)

这不起作用,并且不会捕获多行文本。我该如何为此编写工作步骤定义?

Gra*_*per 5

就用这个- @Then("^the returned information should be$"). String向该方法添加一个参数。多行文本将自动注入到参数中。

@Then("^the returned information should be$")
public void blahblah(String multi) {}
Run Code Online (Sandbox Code Playgroud)