I am using DurableState for my project. Earlier I was using EventSourcedBehavior. But after moving to DurableState all my JUnits are failing. I am using PersistenceTestKit and Plugin. We are also using Sharding.
Can somebody please share which TestKit needs to be used ?
Thanks for the response. But its still not working. We are using sharding.
This is my actor:
public class InterimActor
extends DurableStateBehavior<InterimActor.Command, InterimActor.State> {
My JUnit: @ExtendWith(MockitoExtension.class)
class InterimActorTest { @ClassRule
public static final TestKitJunitResource testKit =
new TestKitJunitResource(
PersistenceTestKitPlugin.getInstance()
.config()
.withFallback(ConfigFactory.defaultApplication().resolve()));
My test passes, but how do I check what is getting persisted in the State ? I am only able to check what messages are received by my actors. I wanted to see the updates to my state object.
You should be able to get the DurableStateStoreQuery as described in Persistence Query • Akka Documentation
Then you can use the getObject(persistenceId) to retrieve the value.