Migrate netconf to mockito ArgumentMatchers
[netconf.git] / netconf / mdsal-netconf-connector / src / test / java / org / opendaylight / netconf / mdsal / connector / ops / RuntimeRpcTest.java
index 60ac65ab688f0c6a51264b99f79784cc66db5299..3e88711d48af1cf6ff257d305fa1a6a27e90d6ac 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.netconf.mdsal.connector.ops;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
@@ -32,17 +32,17 @@ import org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
-import org.opendaylight.controller.config.util.xml.DocumentedException;
-import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorSeverity;
-import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorTag;
-import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorType;
-import org.opendaylight.controller.config.util.xml.XmlUtil;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.netconf.api.DocumentedException;
+import org.opendaylight.netconf.api.DocumentedException.ErrorSeverity;
+import org.opendaylight.netconf.api.DocumentedException.ErrorTag;
+import org.opendaylight.netconf.api.DocumentedException.ErrorType;
+import org.opendaylight.netconf.api.xml.XmlUtil;
 import org.opendaylight.netconf.mapping.api.HandlingPriority;
 import org.opendaylight.netconf.mapping.api.NetconfOperationChainedExecution;
 import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
@@ -126,7 +126,8 @@ public class RuntimeRpcTest {
                 @Nonnull final SchemaPath type, @Nullable final NormalizedNode<?, ?> input) {
             final Collection<DataContainerChild<? extends PathArgument, ?>> children =
                     (Collection<DataContainerChild<? extends PathArgument, ?>>) input.getValue();
-            final Module module = schemaContext.findModule(type.getLastComponent().getNamespace()).orElse(null);
+            final Module module = schemaContext.findModules(type.getLastComponent().getNamespace()).stream()
+                .findFirst().orElse(null);
             final RpcDefinition rpcDefinition = getRpcDefinitionFromModule(
                 module, module.getNamespace(), type.getLastComponent().getLocalName());
             final ContainerSchemaNode outputSchemaNode = rpcDefinition.getOutput();
@@ -149,7 +150,7 @@ public class RuntimeRpcTest {
     private CurrentSchemaContext currentSchemaContext = null;
 
     @Mock
-    private SchemaService schemaService;
+    private DOMSchemaService schemaService;
     @Mock
     private SchemaContextListener listener;
     @Mock
@@ -162,8 +163,6 @@ public class RuntimeRpcTest {
         initMocks(this);
         doNothing().when(registration).close();
         doReturn(listener).when(registration).getInstance();
-        doNothing().when(schemaService).addModule(any(Module.class));
-        doNothing().when(schemaService).removeModule(any(Module.class));
         doReturn(schemaContext).when(schemaService).getGlobalContext();
         doReturn(schemaContext).when(schemaService).getSessionContext();
         doAnswer(invocationOnMock -> {