Skip to content

Instantly share code, notes, and snippets.

@skywall
Created November 7, 2020 20:59
Show Gist options
  • Save skywall/ff4c6e49a79e7581a6cb5ee1388dab29 to your computer and use it in GitHub Desktop.
Save skywall/ff4c6e49a79e7581a6cb5ee1388dab29 to your computer and use it in GitHub Desktop.
TicketMachineTest - Naive
class TicketMachineTest {
private val printerMock = mockk<Printer>(relaxed = true)
@Test
fun `given ticket machine when adult ticket selected and paid then ticket printed`() {
val ticketMachine = TicketMachine(printerMock, Display(), CoinCounter())
ticketMachine.selectTicket(TicketType.ADULT)
ticketMachine.insertCoin()
ticketMachine.insertCoin()
verify { printerMock.printTicket(TicketType.ADULT) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment