Migrate restconf/restconf-nb tests to JUnit5
[netconf.git] / restconf / restconf-nb / src / test / java / org / opendaylight / restconf / nb / rfc8040 / databind / AbstractResourceBodyTest.java
index fc4da82c502f86b1ca493649a0696e983cfcef56..65f0ede627919ef81de7811306e3ee6eac010492 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
+import com.google.common.collect.ImmutableMap;
 import java.io.IOException;
 import java.io.InputStream;
 import java.text.ParseException;
@@ -28,8 +29,10 @@ import org.opendaylight.restconf.api.ApiPath;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import org.opendaylight.restconf.common.errors.RestconfError;
 import org.opendaylight.restconf.nb.rfc8040.rests.transactions.MdsalRestconfStrategy;
-import org.opendaylight.restconf.server.api.DataPutPath;
+import org.opendaylight.restconf.nb.rfc8040.rests.transactions.RestconfStrategy.StrategyAndPath;
 import org.opendaylight.restconf.server.api.DatabindContext;
+import org.opendaylight.restconf.server.api.ResourceBody;
+import org.opendaylight.restconf.server.api.ServerException;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -84,12 +87,17 @@ abstract class AbstractResourceBodyTest extends AbstractBodyTest {
             throw new AssertionError(e);
         }
 
-        final var strategy = new MdsalRestconfStrategy(DATABIND, dataBroker, null, null, null, mountPointService);
-        final var stratAndPath = strategy.resolveStrategyPath(apiPath);
+        final var strategy = new MdsalRestconfStrategy(DATABIND, dataBroker, ImmutableMap.of(), null, null, null,
+            mountPointService);
+        final StrategyAndPath stratAndPath;
+        try {
+            stratAndPath = strategy.resolveStrategyPath(apiPath);
+        } catch (ServerException e) {
+            throw new AssertionError(e);
+        }
 
         try (var body = bodyConstructor.apply(stringInputStream(patchBody))) {
-            return body.toNormalizedNode(new DataPutPath(stratAndPath.strategy().databind(),
-                stratAndPath.path().inference(), stratAndPath.path().instance()));
+            return body.toNormalizedNode(stratAndPath.path());
         }
     }