X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatabroker%2Factors%2Fdds%2FAbstractDataStoreClientBehaviorTest.java;h=14a29c5101394be7a971802769bfa7f1ecd40e25;hb=refs%2Fchanges%2F78%2F100478%2F3;hp=0b379f9655454eceb73c926218b8f688c9bee0fc;hpb=e84f63ee098fff5b02cbce1281ca0d1208f966fa;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehaviorTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehaviorTest.java index 0b379f9655..14a29c5101 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehaviorTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientBehaviorTest.java @@ -10,9 +10,9 @@ package org.opendaylight.controller.cluster.databroker.actors.dds; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThrows; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.CLIENT_ID; import akka.actor.ActorRef; @@ -134,14 +134,15 @@ public abstract class AbstractDataStoreClientBehaviorTest { public void testGetConnection() { //set up data tree mock final CursorAwareDataTreeModification modification = mock(CursorAwareDataTreeModification.class); - when(modification.readNode(YangInstanceIdentifier.empty())).thenReturn(Optional.empty()); + doReturn(Optional.empty()).when(modification).readNode(YangInstanceIdentifier.empty()); final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class); - when(snapshot.newModification()).thenReturn(modification); + doReturn(modification).when(snapshot).newModification(); final DataTree dataTree = mock(DataTree.class); - when(dataTree.takeSnapshot()).thenReturn(snapshot); + doReturn(snapshot).when(dataTree).takeSnapshot(); final TestProbe backendProbe = new TestProbe(system, "backend"); final long shard = 0L; + behavior.createTransaction().read(YangInstanceIdentifier.empty()); final AbstractClientConnection connection = behavior.getConnection(shard); //check cached connection for same shard @@ -167,8 +168,7 @@ public abstract class AbstractDataStoreClientBehaviorTest { final ActorSelection selection = system.actorSelection(actor.path()); final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0); promise.success(shardInfo); - when(mock.findPrimaryShardAsync(SHARD)).thenReturn(promise.future()); + doReturn(promise.future()).when(mock).findPrimaryShardAsync(SHARD); return mock; } - }