- new JavaTestKit(getSystem()) {{
- ActorContext actorContext = mock(ActorContext.class);
-
- String shardName = "shard-1";
- final DataChangeListenerRegistrationProxy proxy = new DataChangeListenerRegistrationProxy(
- shardName, actorContext, mockListener);
-
- doReturn(DatastoreContext.newBuilder().build()).when(actorContext).getDatastoreContext();
- doReturn(getSystem().dispatchers().defaultGlobalDispatcher()).when(actorContext).getClientDispatcher();
- doReturn(getSystem()).when(actorContext).getActorSystem();
- doReturn(Dispatchers.DEFAULT_DISPATCHER_PATH).when(actorContext).getNotificationDispatcherPath();
- doReturn(getSystem().actorSelection(getRef().path())).
- when(actorContext).actorSelection(getRef().path());
- doReturn(duration("5 seconds")).when(actorContext).getOperationDuration();
- doReturn(Futures.successful(getRef())).when(actorContext).findLocalShardAsync(eq(shardName));
-
- Answer<Future<Object>> answer = new Answer<Future<Object>>() {
- @Override
- public Future<Object> answer(InvocationOnMock invocation) {
+ new JavaTestKit(getSystem()) {
+ {
+ ActorContext actorContext = mock(ActorContext.class);
+
+ String shardName = "shard-1";
+ final DataChangeListenerRegistrationProxy proxy = new DataChangeListenerRegistrationProxy(
+ shardName, actorContext, mockListener);
+
+ doReturn(DatastoreContext.newBuilder().build()).when(actorContext).getDatastoreContext();
+ doReturn(getSystem().dispatchers().defaultGlobalDispatcher()).when(actorContext).getClientDispatcher();
+ doReturn(getSystem()).when(actorContext).getActorSystem();
+ doReturn(Dispatchers.DEFAULT_DISPATCHER_PATH).when(actorContext).getNotificationDispatcherPath();
+ doReturn(getSystem().actorSelection(getRef().path()))
+ .when(actorContext).actorSelection(getRef().path());
+ doReturn(duration("5 seconds")).when(actorContext).getOperationDuration();
+ doReturn(Futures.successful(getRef())).when(actorContext).findLocalShardAsync(eq(shardName));
+
+ Answer<Future<Object>> answer = invocation -> {