Pesticide DDT로 전환하기
이제 Pesticide를 사용해 첫 번째 테스트를 완료할 수 있다. 인수 테스트를 작성한 방법과 크게 다르지 않지만 몇 가지 미묘한 차이가 있다.
class SeeATodoListDDT : ZettaiDDT(allActions()) {
val frank by NamedActor(::ToDoListOwner) ➊
val bob by NamedActor(::ToDoListOwner)
val shoppingListName = "shopping"
val shoppingItems = listOf("carrots", "apples", "milk")
val gardenListName = "gardening"
val gardenItems = listOf("fix the fence", "mowing the lawn")
@DDT
fun `List owners can see their lists`() = ddtScenario {
setUp { ➋
frank.`starts with a list`(shoppingListName, shoppingItems), ➌
bob.`starts with a list`(gardenListName, gardenItems)
}.thenPlay( ➍
frank.`can see #listname with #itemnames`(
shoppingListName, shoppingItems), ➎
bob.`can see #listname with #itemnames`(
gardenListName, gardenItems)
)
}
}