StateMachine
StateMachine copied to clipboard
Can't test transitions
Hi,
As in your readme file, I would like to test the transitions:
assertThat(transition).isEqualTo(
StateMachine.Transition.Valid(Solid, OnMelted, Liquid, LogMelted)
)
But, the "Valid" data class has an internal constructor so I can't access it in my tests.
What should I do ? Thanks.
I have the same problem. Would be great to be able to write unit tests.
Any update on the lib to make StateMachine.Transition.Valid have a public constructor?
Can't make proper tests following the readme.
I believe you can do this
assertThat(transition).isInstanceOf(StateMachine.Transition.Valid::class.java)
assertThat(invalidTransition).isInstanceOf(StateMachine.Transition.Invalid::class.java)
and assert fromState and event from transition, although you still don't have access to toState and sideEffect