Yes, given that example the scaladoc is right... then I must have a bug in my code, I guess.
In
https://gist.github.com/lrodero/e5923dc6969b53814ce7 I've copied an example of the system I'm testing. It's a very dummy vending machine of soft drinks that accepts three commands, when each command is called the machine state is printed. The
DrinksTesting object takes care of the testing. It contains three classes extending
Command that represent the machine commands. In each of those command classes the
postCondition method prints the state and result passed as parameters. Running the example I find things like:
RELOADING <- Reloading machine
LOAD Vector((SPRITE,84), (COKE,78))
VENDMACHI Map(SPRITE -> SoftDrinkData(336,0.0), FANTA -> SoftDrinkData(96,5.0), COKE -> SoftDrinkData(312,0.0)) <- Internal state before
VENDMACHI Map(SPRITE -> SoftDrinkData(420,0.0), FANTA -> SoftDrinkData(96,5.0), COKE -> SoftDrinkData(390,0.0)) <- Internal state after reloading
NEXTST Map(SPRITE -> SoftDrinkData(420,0.0), FANTA -> SoftDrinkData(96,5.0), COKE -> SoftDrinkData(390,0.0)) <- Calling to nextState()
RELOAD Vector((SPRITE,84), (COKE,78)) <- Calling to postCondition()
PREVSTATE Map(SPRITE -> SoftDrinkData(420,0.0), FANTA -> SoftDrinkData(96,5.0), COKE -> SoftDrinkData(390,0.0)) <- prev. state
VENDMACHI Map(SPRITE -> SoftDrinkData(420,0.0), FANTA -> SoftDrinkData(96,5.0), COKE -> SoftDrinkData(390,0.0)) <- result
MISMATCH <- :(