Migrate Collections references
[netconf.git] / plugins / netconf-client-mdsal / src / test / java / org / opendaylight / netconf / client / mdsal / NetconfNestedNotificationTest.java
index d27d5ae66368ca7cde8ee872c7d827da26899fa8..03f965678d2832037f1a87a0771a2325c8154fba 100644 (file)
@@ -8,13 +8,10 @@
 package org.opendaylight.netconf.client.mdsal;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Collection;
-import java.util.Collections;
 import org.junit.Test;
 import org.opendaylight.mdsal.dom.api.DOMEvent;
 import org.opendaylight.mdsal.dom.api.DOMNotification;
@@ -25,8 +22,6 @@ import org.opendaylight.netconf.client.mdsal.impl.NetconfMessageTransformer;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MountPointContext;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 import org.w3c.dom.Document;
@@ -41,11 +36,12 @@ public class NetconfNestedNotificationTest extends AbstractBaseSchemasTest {
 
     @Test
     public void testNestedNotificationToNotificationFunction() throws Exception {
-        final EffectiveModelContext schemaContext =
-                getNotificationSchemaContext(Collections.singleton("/schemas/nested-notification.yang"));
+        final var context = YangParserTestUtils.parseYangResources(
+            NetconfNestedNotificationTest.class, "/schemas/nested-notification.yang");
+
         final NetconfMessage notificationMessage = prepareNotification("/nested-notification-payload.xml");
         NetconfMessageTransformer messageTransformer = new NetconfMessageTransformer(
-            MountPointContext.of(schemaContext), true, BASE_SCHEMAS.getBaseSchema());
+            MountPointContext.of(context), true, BASE_SCHEMAS.getBaseSchema());
         final DOMNotification domNotification = messageTransformer.toNotification(notificationMessage);
         final ContainerNode root = domNotification.getBody();
         assertNotNull(root);
@@ -57,13 +53,6 @@ public class NetconfNestedNotificationTest extends AbstractBaseSchemasTest {
                 domNotification.getType());
     }
 
-    private EffectiveModelContext getNotificationSchemaContext(final Collection<String> yangResources) {
-        final EffectiveModelContext context = YangParserTestUtils.parseYangResources(getClass(), yangResources);
-        final Collection<? extends Module> modules = context.getModules();
-        assertFalse(modules.isEmpty());
-        return context;
-    }
-
     private NetconfMessage prepareNotification(final String notificationPayloadPath) throws IOException, SAXException {
         InputStream notifyPayloadStream = getClass().getResourceAsStream(notificationPayloadPath);
         assertNotNull(notifyPayloadStream);