Update RESTCONF error mapping
[netconf.git] / restconf / restconf-nb-rfc8040 / src / test / java / org / opendaylight / restconf / nb / rfc8040 / jersey / providers / test / XmlBodyReaderTest.java
index 15ba17429a8688f11fbce9bf120baecc809b3670..ecc7d860a573daf20ea947f447126dbb42fd3ce5 100644 (file)
@@ -13,8 +13,10 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import com.google.common.collect.Sets;
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 import java.util.Collection;
 import java.util.Optional;
 import javax.ws.rs.core.MediaType;
@@ -283,4 +285,14 @@ public class XmlBodyReaderTest extends AbstractBodyReaderTest {
         }
     }
 
+    @Test
+    public void testRangeViolation() throws Exception {
+        mockBodyReader("netconf786:foo", this.xmlBodyReader, false);
+
+        final InputStream inputStream = new ByteArrayInputStream(
+            "<foo xmlns=\"netconf786\"><bar>100</bar></foo>".getBytes(StandardCharsets.UTF_8));
+
+        assertRangeViolation(() -> xmlBodyReader.readFrom(null, null, null, this.mediaType, null, inputStream));
+    }
+
 }