import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
assertEquals("121", lf2.getValue());
}
+ @Test
+ public void testXmlBlankInput() throws Exception {
+ InputStream inputStream = new ByteArrayInputStream("".getBytes());
+ CompositeNode compositeNode = XmlToCompositeNodeProvider.INSTANCE.readFrom(null, null, null, null, null,
+ inputStream);
+
+ assertNull(compositeNode);
+ }
+
+ @Test
+ public void testXmlBlankInputUnmarkableStream() throws Exception {
+ InputStream inputStream = new ByteArrayInputStream("".getBytes()) {
+ @Override
+ public boolean markSupported() {
+ return false;
+ }
+ };
+ CompositeNode compositeNode = XmlToCompositeNodeProvider.INSTANCE.readFrom(null, null, null, null, null,
+ inputStream);
+
+ assertNull(compositeNode);
+ }
+
}