所以我遇到以下代码的麻烦,我看不出是什么问题。我已经多次尝试,如注释掉的代码所示,但它似乎没有缓解这个问题。 每次我尝试运行测试时,我都会收到错误:“没有这样的属性:exp为类:SpockTestSOAP”。任何帮助将不胜感激。
@Test
@Unroll
public void 'Web service generateSolution correctly truncates integer division: (#exp) is #expectedResult'() {
/*when: 'the an integer division expression is evaluated'
String result = generateSolution(exp);
then: 'the result correctly truncates the exact expression'
result == expectedResult*/
expect:
generateSolution(exp) == expectedResult
where:
exp || expectedResult
"1/3" || "0"
"5/2" || "2"
"13/8" || "1"
"126/5" || "25"
}