Testing Akka Persistent FSM Actor with the applying method

315 views Asked by At

I am trying to develop an FSM model in AKKA using its Java api. I wish to unit test this feature. I have gone through numerous examples on unit testing Akka FSM actors with lambda support but i couldn't find any relevant example which tests the .applying and the .andthen method of the same, so that i can be sure that the test covers the custom handle logic derived from the parameters of the DomainEventB.

startWith(STATE A, new domain());

    when(STATE A, matchEvent(DomainEventA.class, Domain.class, (domainEventA, domain) -> goTo(STATE B)));

    when(STATE B,
        matchEvent(DomainEventB.class, Domain.class,
            (domainEventB, domain) -> stay()
                .applying(new DomainEventB())
                .andThen(exec(domain -> {
                 // handle logic
                })));

Any help/resource preferably in Java will be much appreciated.

0

There are 0 answers