Migrate from JavaTestKit to javadsl.TestKit
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / entityownership / EntityOwnershipListenerSupportTest.java
index 4acf572851aa114f7789f3010096a3790d12b35a..c806d1de106237e1961a1b79f752446ad3d46982 100644 (file)
@@ -18,8 +18,8 @@ import static org.mockito.Mockito.verify;
 import akka.actor.ActorContext;
 import akka.actor.ActorRef;
 import akka.actor.Props;
-import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import akka.testkit.javadsl.TestKit;
 import com.google.common.util.concurrent.Uninterruptibles;
 import java.util.ArrayList;
 import java.util.List;
@@ -127,9 +127,9 @@ public class EntityOwnershipListenerSupportTest extends AbstractEntityOwnershipT
 
         // Unregister all listeners and verify their listener actors are destroyed.
 
-        List<JavaTestKit> watchers = new ArrayList<>();
+        List<TestKit> watchers = new ArrayList<>();
         for (Iterator<ActorRef> iter = listenerActors.iterator(); iter.hasNext();) {
-            JavaTestKit kit = new JavaTestKit(getSystem());
+            TestKit kit = new TestKit(getSystem());
             kit.watch(iter.next());
             watchers.add(kit);
         }
@@ -139,8 +139,8 @@ public class EntityOwnershipListenerSupportTest extends AbstractEntityOwnershipT
         support.removeEntityOwnershipListener(entityType2, mockListener2);
 
         Iterator<ActorRef> iter = listenerActors.iterator();
-        for (JavaTestKit kit: watchers) {
-            kit.expectTerminated(JavaTestKit.duration("3 seconds"), iter.next());
+        for (TestKit kit: watchers) {
+            kit.expectTerminated(kit.duration("3 seconds"), iter.next());
         }
 
         assertEquals("# of listener actors", 0, actorContext.children().size());
@@ -161,25 +161,4 @@ public class EntityOwnershipListenerSupportTest extends AbstractEntityOwnershipT
         support.addEntityOwnershipListener(entityType1, mockListener2);
         support.removeEntityOwnershipListener(entityType1, mockListener2);
     }
-
-    @Test
-    public void testHasCandidateForEntity() {
-        EntityOwnershipListenerSupport support = new EntityOwnershipListenerSupport(actorContext, "test");
-        DOMEntity entity = new DOMEntity("type", YangInstanceIdentifier.of(QName.create("test", "id")));
-
-        assertEquals("hasCandidateForEntity", false, support.hasCandidateForEntity(entity));
-
-        support.setHasCandidateForEntity(entity);
-        support.setHasCandidateForEntity(entity); // set again - should be noop
-        assertEquals("hasCandidateForEntity", true, support.hasCandidateForEntity(entity));
-
-        support.unsetHasCandidateForEntity(entity);
-        assertEquals("hasCandidateForEntity", false, support.hasCandidateForEntity(entity));
-
-        support.unsetHasCandidateForEntity(entity); // unset again - should be noop
-        assertEquals("hasCandidateForEntity", false, support.hasCandidateForEntity(entity));
-
-        support.setHasCandidateForEntity(entity);
-        assertEquals("hasCandidateForEntity", true, support.hasCandidateForEntity(entity));
-    }
 }