diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-06-18 11:30:26 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-06-18 11:30:26 +0000 |
commit | f7ecc8fe21b15a2c9da17eb96a7bd6375b2b6043 (patch) | |
tree | d52510e7516b1c77e546ad3cb14a8349322f5be9 /vespaclient-container-plugin | |
parent | c6afcd087b79dabb47db611881c4d0f96a980d15 (diff) |
Add missing file
Diffstat (limited to 'vespaclient-container-plugin')
-rw-r--r-- | vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/FeedReaderFactoryTestCase.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/FeedReaderFactoryTestCase.java b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/FeedReaderFactoryTestCase.java new file mode 100644 index 00000000000..dab328d56d4 --- /dev/null +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/FeedReaderFactoryTestCase.java @@ -0,0 +1,31 @@ +package com.yahoo.vespa.http.server; + +import com.yahoo.document.DocumentTypeManager; +import com.yahoo.text.Utf8; +import com.yahoo.vespa.http.client.config.FeedParams; +import org.junit.Test; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class FeedReaderFactoryTestCase { + FeedReaderFactory ffr = new FeedReaderFactory(); + DocumentTypeManager manager = new DocumentTypeManager(); + + private InputStream createStream(String s) { + return new ByteArrayInputStream(Utf8.toBytes(s)); + } + + @Test + public void testXmlException() { + try { + ffr.createReader(createStream("Some malformed xml"), manager, FeedParams.DataFormat.XML_UTF8); + fail(); + } catch (RuntimeException e) { + assertEquals("Could not create VespaXMLFeedReader. First characters are: 'Some malformed xml'", e.getMessage()); + } + } +} |