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%2Factors%2FShardSnapshotActorTest.java;h=0a5c40d29d3ae6b96f5765bfd549e10aff177a70;hb=HEAD;hp=b69c6c86627b1218599fadf2bc1b50ea8107f3fa;hpb=abaef4a5ae37f27542155457fe7306a4662b1eeb;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActorTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActorTest.java index b69c6c8662..0a5c40d29d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActorTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActorTest.java @@ -9,7 +9,6 @@ package org.opendaylight.controller.cluster.datastore.actors; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import akka.actor.ActorRef; import akka.testkit.javadsl.TestKit; @@ -40,7 +39,7 @@ public class ShardSnapshotActorTest extends AbstractActorTest { final ActorRef snapshotActor = getSystem().actorOf(ShardSnapshotActor.props(STREAM_FACTORY), testName); kit.watch(snapshotActor); - final NormalizedNode expectedRoot = snapshot.getRootNode().get(); + final NormalizedNode expectedRoot = snapshot.getRootNode().orElseThrow(); ByteArrayOutputStream installSnapshotStream = withInstallSnapshot ? new ByteArrayOutputStream() : null; ShardSnapshotActor.requestSnapshot(snapshotActor, snapshot, @@ -59,10 +58,7 @@ public class ShardSnapshotActorTest extends AbstractActorTest { } assertEquals("Deserialized snapshot type", snapshot.getClass(), deserialized.getClass()); - - final Optional maybeNode = deserialized.getRootNode(); - assertTrue("isPresent", maybeNode.isPresent()); - assertEquals("Root node", expectedRoot, maybeNode.get()); + assertEquals("Root node", Optional.of(expectedRoot), deserialized.getRootNode()); } }