Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't test transitions #24

Open
OlivierHartmann opened this issue Nov 6, 2019 · 3 comments
Open

Can't test transitions #24

OlivierHartmann opened this issue Nov 6, 2019 · 3 comments

Comments

@OlivierHartmann
Copy link

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.

@OlivierHartmann OlivierHartmann changed the title Can't testing transitions Can't test transitions Nov 6, 2019
@rs-georg
Copy link

I have the same problem. Would be great to be able to write unit tests.

@fredydoss
Copy link

Any update on the lib to make StateMachine.Transition.Valid have a public constructor?
Can't make proper tests following the readme.

@fabiofalci
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants