- new TestKit(getSystem()) {
- {
- ActorContext actorContext = mock(ActorContext.class);
-
- String shardName = "shard-1";
-
- 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));
-
- final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
- actorContext, mockListener, YangInstanceIdentifier.of(TestModel.TEST_QNAME));
-
- Answer<Future<Object>> answer = invocation -> {
- proxy.close();
- return Futures.successful((Object) new RegisterDataTreeNotificationListenerReply(getRef()));
- };
+ final TestKit kit = new TestKit(getSystem());
+ ActorUtils actorUtils = mock(ActorUtils.class);
+
+ String shardName = "shard-1";
+
+ doReturn(DatastoreContext.newBuilder().build()).when(actorUtils).getDatastoreContext();
+ doReturn(getSystem().dispatchers().defaultGlobalDispatcher()).when(actorUtils).getClientDispatcher();
+ doReturn(getSystem()).when(actorUtils).getActorSystem();
+ doReturn(Dispatchers.DEFAULT_DISPATCHER_PATH).when(actorUtils).getNotificationDispatcherPath();
+ doReturn(getSystem().actorSelection(kit.getRef().path())).when(actorUtils).actorSelection(
+ kit.getRef().path());
+ doReturn(kit.duration("5 seconds")).when(actorUtils).getOperationDuration();
+ doReturn(Futures.successful(kit.getRef())).when(actorUtils).findLocalShardAsync(eq(shardName));
+
+ final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
+ actorUtils, mockListener, YangInstanceIdentifier.of(TestModel.TEST_QNAME));
+
+ Answer<Future<Object>> answer = invocation -> {
+ proxy.close();
+ return Futures.successful((Object) new RegisterDataTreeNotificationListenerReply(kit.getRef()));
+ };