Simplify code using Java 8 features
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / entityownership / EntityOwnershipShardTest.java
index ca104f1ecfab8ab866c09f53fde5939cf37387a4..a91ca9c9b54d568e0c0ba592b91ae1ba9c675c18 100644 (file)
@@ -26,7 +26,6 @@ import akka.actor.PoisonPill;
 import akka.actor.Props;
 import akka.actor.Terminated;
 import akka.dispatch.Dispatchers;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.Uninterruptibles;
@@ -103,7 +102,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnRegisterCandidateLocal() throws Exception {
+    public void testOnRegisterCandidateLocal() {
         testLog.info("testOnRegisterCandidateLocal starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -125,7 +124,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnRegisterCandidateLocalWithNoInitialLeader() throws Exception {
+    public void testOnRegisterCandidateLocalWithNoInitialLeader() {
         testLog.info("testOnRegisterCandidateLocalWithNoInitialLeader starting");
 
         final ShardTestKit kit = new ShardTestKit(getSystem());
@@ -160,7 +159,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnRegisterCandidateLocalWithNoInitialConsensus() throws Exception {
+    public void testOnRegisterCandidateLocalWithNoInitialConsensus() {
         testLog.info("testOnRegisterCandidateLocalWithNoInitialConsensus starting");
 
         final ShardTestKit kit = new ShardTestKit(getSystem());
@@ -245,7 +244,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnRegisterCandidateLocalWithRemoteLeader() throws Exception {
+    public void testOnRegisterCandidateLocalWithRemoteLeader() {
         testLog.info("testOnRegisterCandidateLocalWithRemoteLeader starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -301,7 +300,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnUnregisterCandidateLocal() throws Exception {
+    public void testOnUnregisterCandidateLocal() {
         testLog.info("testOnUnregisterCandidateLocal starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -337,7 +336,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOwnershipChanges() throws Exception {
+    public void testOwnershipChanges() {
         testLog.info("testOwnershipChanges starting");
 
         final ShardTestKit kit = new ShardTestKit(getSystem());
@@ -524,7 +523,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(peer2);
         peer2.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
         kit.unwatch(peer2);
 
         leader.tell(new PeerDown(peerId2.getMemberName(), peerId2.toString()), ActorRef.noSender());
@@ -591,7 +590,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(peer1);
         peer1.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
         kit.unwatch(peer1);
         leader.tell(new PeerDown(peerId1.getMemberName(), peerId1.toString()), ActorRef.noSender());
 
@@ -637,9 +636,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
             leaderLastApplied.set(rs.getLastApplied());
         });
 
-        verifyRaftState(peer2, rs -> {
-            assertEquals("LastApplied", leaderLastApplied.get(), rs.getLastIndex());
-        });
+        verifyRaftState(peer2, rs -> assertEquals("LastApplied", leaderLastApplied.get(), rs.getLastIndex()));
 
         // Kill the local leader and elect peer2 the leader. This should cause a new owner to be selected for
         // the entities (1 and 3) previously owned by the local leader member.
@@ -650,7 +647,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(leader);
         leader.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
         kit.unwatch(leader);
         peer2.tell(new PeerDown(leaderId.getMemberName(), leaderId.toString()), ActorRef.noSender());
         peer2.tell(TimeoutNow.INSTANCE, peer2);
@@ -1045,7 +1042,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testListenerRegistration() throws Exception {
+    public void testListenerRegistration() {
         testLog.info("testListenerRegistration starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -1138,7 +1135,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived() throws Exception {
+    public void testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived() {
         testLog.info("testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -1180,7 +1177,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testDelayedEntityOwnerSelection() throws Exception {
+    public void testDelayedEntityOwnerSelection() {
         testLog.info("testDelayedEntityOwnerSelection starting");
 
         final ShardTestKit kit = new ShardTestKit(getSystem());