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

如何在Java中捕获cucumber中的多行文本,java,cucumber,Java,Cucumber,我有一个Java cucumber测试,它有以下测试用例: ..... 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 """ 我写的步骤是: @Then("^the returned information should be (.

我有一个Java cucumber测试,它有以下测试用例:

.....
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
  """
我写的步骤是:

@Then("^the returned information should be (.*)$")

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

只需使用此-
@然后(“^返回的信息应为$”
)。将
字符串
参数添加到方法中。多行文字将自动注入参数中

@Then("^the returned information should be$")
public void blahblah(String multi) {}

为了让这一切顺利进行,我不得不把$。例如:
@然后(“^返回的信息应该是”)