- final DistributedDataStore distributedDataStore = new DistributedDataStore(actorContext);
- doReturn(datastoreContext).when(actorContext).getDatastoreContext();
- doReturn(shardElectionTimeout).when(datastoreContext).getShardLeaderElectionTimeout();
- doReturn(FiniteDuration.apply(5000, TimeUnit.MILLISECONDS)).when(shardElectionTimeout).duration();
+ try (final DistributedDataStore distributedDataStore = new DistributedDataStore(actorContext, UNKNOWN_ID)) {
+ doReturn(datastoreContext).when(actorContext).getDatastoreContext();
+ doReturn(shardElectionTimeout).when(datastoreContext).getShardLeaderElectionTimeout();
+ doReturn(FiniteDuration.apply(5000, TimeUnit.MILLISECONDS)).when(shardElectionTimeout).duration();