@Test
public void testOnDatastoreContext() {

    dataStoreContextBuilder.persistent(true);
    final TestActorRef<Shard> shard = actorFactory.createTestActor(newShardProps(), "testOnDatastoreContext");
    assertTrue("isRecoveryApplicable", shard.underlyingActor().persistence().isRecoveryApplicable());
    ShardTestKit.waitUntilLeader(shard);
    shard.tell(dataStoreContextBuilder.persistent(false).build(), ActorRef.noSender());
    assertFalse("isRecoveryApplicable", shard.underlyingActor().persistence().isRecoveryApplicable());
    shard.tell(dataStoreContextBuilder.persistent(true).build(), ActorRef.noSender());
    assertTrue("isRecoveryApplicable", shard.underlyingActor().persistence().isRecoveryApplicable());
}