@Test
public void testSetDatastoreContext() {

    final TestKit testKit = new TestKit(getSystem());
    ActorUtils actorUtils = new ActorUtils(getSystem(), testKit.getRef(),
        mock(ClusterWrapper.class), mock(Configuration.class), DatastoreContext.newBuilder()
        .operationTimeoutInSeconds(5).shardTransactionCommitTimeoutInSeconds(7).build(),
        new PrimaryShardInfoFutureCache());
    assertEquals("getOperationDuration", 5, actorUtils.getOperationDuration().toSeconds());
    assertEquals("getTransactionCommitOperationTimeout", 7,
        actorUtils.getTransactionCommitOperationTimeout().duration().toSeconds());
    DatastoreContext newContext = DatastoreContext.newBuilder().operationTimeoutInSeconds(6)
            .shardTransactionCommitTimeoutInSeconds(8).build();
    DatastoreContextFactory mockContextFactory = mock(DatastoreContextFactory.class);
    Mockito.doReturn(newContext).when(mockContextFactory).getBaseDatastoreContext();
    actorUtils.setDatastoreContext(mockContextFactory);
    testKit.expectMsgClass(Duration.ofSeconds(5), DatastoreContextFactory.class);
    Assert.assertSame("getDatastoreContext", newContext, actorUtils.getDatastoreContext());
    assertEquals("getOperationDuration", 6, actorUtils.getOperationDuration().toSeconds());
    assertEquals("getTransactionCommitOperationTimeout", 8,
        actorUtils.getTransactionCommitOperationTimeout().duration().toSeconds());
}