import akka.actor.ActorRef;
import akka.actor.DeadLetter;
import akka.actor.Props;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
import com.google.common.collect.ImmutableList;
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
import org.opendaylight.controller.cluster.datastore.messages.DataTreeChangedReply;
import org.opendaylight.controller.cluster.datastore.messages.EnableNotification;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
public class DataTreeChangeListenerActorTest extends AbstractActorTest {
@Test
public void testDataChangedWhenNotificationsAreEnabled() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
@Test
public void testDataChangedWhenNotificationsAreDisabled() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
subject.tell(new DataTreeChanged(mockCandidates), getRef());
- new Within(duration("1 seconds")) {
- @Override
- protected void run() {
- expectNoMsg();
-
- Mockito.verify(mockListener, Mockito.never())
- .onDataTreeChanged(Matchers.anyCollectionOf(DataTreeCandidate.class));
- }
- };
+ within(duration("1 seconds"), () -> {
+ expectNoMsg();
+ Mockito.verify(mockListener, Mockito.never())
+ .onDataTreeChanged(Matchers.anyCollectionOf(DataTreeCandidate.class));
+ return null;
+ });
}
};
}
@Test
public void testDataChangedWithNoSender() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates = ImmutableList.of(mockTreeCandidate);
@Test
public void testDataChangedWithListenerRuntimeEx() {
- new JavaTestKit(getSystem()) {
+ new TestKit(getSystem()) {
{
final DataTreeCandidate mockTreeCandidate1 = Mockito.mock(DataTreeCandidate.class);
final ImmutableList<DataTreeCandidate> mockCandidates1 = ImmutableList.of(mockTreeCandidate1);