私は打撃として非常に簡単なテストを持っています:
def "setContent_activity_finished"(Status editStatus) {
// Variables.........................
given:
activity.getStatus() >> editStatus.toString()
when:
handler.setContent(activityId,jsonString)
then:
0*view.appendPossible(_)
where:
editStatus |_
FINISHED |_
CANCELED |_
}
ドキュメントhttp://spock-framework.readthedocs.org/en/latest/data_driven_testing.htmlによると、 データ テーブルには少なくとも 2 つの列が必要です。単一列テーブルは次のように記述できます。
where:
a | _
1 | _
7 | _
0 | _
そして、私はこのルールに従いますが、次の図のようなエラーが表示されます。
Groovy:Date variable '_' needs to be declared as method parameter
だから教えてください ここで何が問題なのですか?