Suppose I have this class:
case class Receipt(id: Long, state: String) {
def transitionTo(newState: String) = {
if (!canTransitionTo(newState)) {
throw new IllegalStateExcetion(s"cant transition from $state to $newState")
}
this.copy(state = newState)
}
}
I'd like to test the logic in canTransitionTo
(not included here for the sake of simplicity) with scalachecks Commands but I'm having a bit of trouble on how to begin. Any ideas?
(I've posted this same question is on stackoverflow, just in case someone wants the extra points)