Introduce HttpStatusCode
[netconf.git] / restconf / restconf-nb / src / test / java / org / opendaylight / restconf / nb / rfc8040 / jersey / providers / errors / RestconfDocumentedExceptionMapperTest.java
index bda623865de6e6c61b7b218e13823fd0ce8a4c55..097d6307166518e0ddde06cf4b3d9a9c044510c3 100644 (file)
@@ -30,21 +30,20 @@ import org.junit.runners.Parameterized.Parameters;
 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
 import org.opendaylight.restconf.common.errors.RestconfError;
 import org.opendaylight.restconf.nb.jaxrs.JaxRsMediaTypes;
+import org.opendaylight.restconf.nb.rfc8040.ErrorTagMapping;
 import org.opendaylight.restconf.server.api.DatabindContext;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.Revision;
-import org.opendaylight.yangtools.yang.common.XMLNamespace;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 import org.skyscreamer.jsonassert.JSONAssert;
 
 @RunWith(Parameterized.class)
 public class RestconfDocumentedExceptionMapperTest {
-    private static final QNameModule MONITORING_MODULE_INFO = QNameModule.create(
-        XMLNamespace.of("instance:identifier:patch:module"), Revision.of("2015-11-21"));
+    private static final QNameModule MONITORING_MODULE_INFO =
+        QNameModule.ofRevision("instance:identifier:patch:module", "2015-11-21");
 
     private static RestconfDocumentedExceptionMapper exceptionMapper;
 
@@ -53,7 +52,8 @@ public class RestconfDocumentedExceptionMapperTest {
         final var schemaContext = YangParserTestUtils.parseYangResources(
                 RestconfDocumentedExceptionMapperTest.class, "/restconf/impl/ietf-restconf@2017-01-26.yang",
                 "/instanceidentifier/yang/instance-identifier-patch-module.yang");
-        exceptionMapper = new RestconfDocumentedExceptionMapper(() -> DatabindContext.ofModel(schemaContext));
+        exceptionMapper = new RestconfDocumentedExceptionMapper(() -> DatabindContext.ofModel(schemaContext),
+            ErrorTagMapping.RFC8040);
     }
 
     /**
@@ -216,7 +216,7 @@ public class RestconfDocumentedExceptionMapperTest {
     }
 
     @Test
-    public void testFormatingJson() throws JSONException {
+    public void testFormattingJson() throws JSONException {
         assumeTrue(expectedResponse.getMediaType().equals(JaxRsMediaTypes.APPLICATION_YANG_DATA_JSON));
 
         exceptionMapper.setHttpHeaders(httpHeaders);
@@ -246,4 +246,4 @@ public class RestconfDocumentedExceptionMapperTest {
             JSONAssert.assertEquals(expectedResponseInJson, actualResponseInJson, true);
         }
     }
-}
\ No newline at end of file
+}