例如,如果我写下面的代码:
expect:
methodToTest(from, to) == result
where:
from | to | result
1508446800000 | 1509483600000 | (Entry) [1506805200000L, 1512075600000L]
其中methodToTest(long from, long to)
返回Entry
我收到错误:
'or' in 'org.codehaus.groovy.runtime.DefaultGroovyMethods' cannot be applied to (Entry).
答案 0 :(得分:1)
你不能在表格中使用构造函数吗?
where:
from | to | result
1508446800000 | 1509483600000 | new Entry(1506805200000L, 1512075600000L)
答案 1 :(得分:-1)
解决方案是替换
from | to | result
1508446800000 | 1509483600000 | new Entry(1506805200000L, 1512075600000L)
带
from | to || result
1508446800000 | 1509483600000 || new Entry(1506805200000L, 1512075600000L)