X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Futils%2FActorUtilsTest.java;h=548d476dc05e071a6f7b6998ba9f26141b6c1ef6;hb=8e1d3c4f9001fbc8a5d3d3bea57916c5099078b2;hp=e40939b55ba4f304837f07167ac6e3bea69e87e4;hpb=55ac0d700c4b20f145924b169b938321dc10a476;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java index e40939b55b..548d476dc0 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorUtilsTest.java @@ -85,8 +85,7 @@ public class ActorUtilsTest extends AbstractActorTest { } @Override public void onReceive(final Object message) { - if (message instanceof FindPrimary) { - FindPrimary fp = (FindPrimary)message; + if (message instanceof FindPrimary fp) { Object resp = findPrimaryResponses.get(fp.getShardName()); if (resp == null) { LOG.error("No expected FindPrimary response found for shard name {}", fp.getShardName()); @@ -149,9 +148,7 @@ public class ActorUtilsTest extends AbstractActorTest { ActorUtils actorUtils = new ActorUtils(getSystem(), shardManagerActorRef, mock(ClusterWrapper.class), mock(Configuration.class)); - Optional out = actorUtils.findLocalShard("default"); - - assertEquals(shardActorRef, out.get()); + assertEquals(Optional.of(shardActorRef), actorUtils.findLocalShard("default")); testKit.expectNoMessage(); return null; @@ -379,7 +376,7 @@ public class ActorUtilsTest extends AbstractActorTest { assertNotNull(actual); assertTrue("LocalShardDataTree present", actual.getLocalShardDataTree().isPresent()); - assertSame("LocalShardDataTree", mockDataTree, actual.getLocalShardDataTree().get()); + assertSame("LocalShardDataTree", mockDataTree, actual.getLocalShardDataTree().orElseThrow()); assertTrue("Unexpected PrimaryShardActor path " + actual.getPrimaryShardActor().path(), expPrimaryPath.endsWith(actual.getPrimaryShardActor().pathString())); assertEquals("getPrimaryShardVersion", DataStoreVersions.CURRENT_VERSION, actual.getPrimaryShardVersion());