- clone vending-machine project
git clone https://[email protected]/pawelszymczyk/vending-machine.git - Checkout proper branch (team01..10)
- If you use IntelliJ, run
gradle ideaor simply import Gradle project - Start playing with tests:
gradle testgradle cleanTest test- to run again when nothing changed (gradle works incrementally) - Kata - implement 4 user stories
Based on http://github.com/guyroyse/vending-machine-kata
As a vendor
I want a vending machine that accepts coins
So that I can collect money from the customer
The vending machine will accept valid coins (nickels, dimes, and quarters) and reject invalid one (pennies). When a valid coin is inserted the amount of the coin will be added to the current amount and the display will be updated. When there are no coins inserted, the machine displays INSERT COIN. Rejected coins are placed in the coin return.
NOTE: The temptation here will be to create Coin objects that know their value. However, this is not how a real vending machine works. Instead, it identifies coins by their weight and size and then assigned a value to what was inserted. You will need to do something similar. This can be simulated using strings, constants, enums, symbols, or something of that nature.
As a vendor
I want customers to select products
So that I can give them an incentive to put money in the machine
There are three products: cola for $1.00, chips for $0.50, and candy for $0.65. When the respective button is pressed and enough money has been inserted, the product is dispensed and the machine displays THANK YOU. If the display is checked again, it will display INSERT COINS and the current amount will be set to $0.00. If there is not enough money inserted then the machine displays PRICE and the price of the item and subsequent checks of the display will display either INSERT COINS or the current amount as appropriate.
As a vendor
I want customers to receive correct change
So that they will use the vending machine again
When a product is selected that costs less than the amount of money in the machine, then the remaining amount is placed in the coin return.
As a venodr
I want to be notified via email when machine runs out of product
Vending machine has one shelve per product, each with 10 items capacity. Full machine contains 10x cola, 10x chips and 10x candy.
Each time when user selects sold out product machine should do two things:
- display NO ${productName}, SORRY
- send email to vendor with supply request
- http://williamdurand.fr/2013/06/03/object-calisthenics/
- http://docs.spockframework.org
- http://github.com/pcierpiatka/groovy_workshop
- http://groovy.codehaus.org/Groovy+style+and+language+feature+guidelines+for+Java+developers
Slot Co 9:00 - 9:30 Spock Intro 9:40 - 11:00 Story 1 accept coins 11:10 - 12:30 Story 2 select product 12:30 - 13:30 Przerwa 13:30 - 14:50 Story 3 make change 15:00 - 16:30 Story 4 storage and emails