summaryrefslogtreecommitdiffstats
path: root/vespa-http-client
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-01-08 08:20:13 +0100
committerGitHub <noreply@github.com>2020-01-08 08:20:13 +0100
commit5489a01db126d4ae6c25bc4a84ff5f2cfd4e5123 (patch)
treedc8ec40545c495f99cb2488fbd06642769d67cf7 /vespa-http-client
parentac86bb091d01e6299d6f3e88c531d1cd6903474d (diff)
Revert "Bjorncs/apache commons libraries cleanup"
Diffstat (limited to 'vespa-http-client')
-rw-r--r--vespa-http-client/pom.xml6
-rw-r--r--vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/XmlFeedReaderTest.java16
2 files changed, 15 insertions, 7 deletions
diff --git a/vespa-http-client/pom.xml b/vespa-http-client/pom.xml
index 7b055228786..bdac1d660dc 100644
--- a/vespa-http-client/pom.xml
+++ b/vespa-http-client/pom.xml
@@ -66,6 +66,12 @@
<!-- Test dependencies -->
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/XmlFeedReaderTest.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/XmlFeedReaderTest.java
index 925f3105878..9abbf916cff 100644
--- a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/XmlFeedReaderTest.java
+++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/XmlFeedReaderTest.java
@@ -1,9 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.client.core;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.yahoo.vespa.http.client.FeedClient;
+import org.apache.commons.lang3.StringEscapeUtils;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -18,6 +17,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.ArgumentMatchers.any;
@@ -32,8 +32,6 @@ public class XmlFeedReaderTest {
private final static String feedResource3 = "/xml-challenge2.xml";
private final static String feedResource4 = "/xml-challenge3.xml";
- private static final XmlMapper xmlMapper = new XmlMapper();
-
private final String updateDocUpdate =
"<?xml version=\"1.0\"?>\n" +
"<vespafeed>\n" +
@@ -234,9 +232,13 @@ public class XmlFeedReaderTest {
InputStream inputStream2 = XmlFeedReaderTest.class.getResourceAsStream(filename);
String rawXML = new java.util.Scanner(inputStream2, "UTF-8").useDelimiter("\\A").next();
- JsonNode decodedDocument = xmlMapper.readTree(document);
- JsonNode rawDocuments = xmlMapper.readTree(rawXML);
- assertThat(decodedDocument, is(rawDocuments.get("document")));
+ String rawDoc = rawXML.toString().split("<document")[1].split("</document>")[0];
+ assertThat(rawDoc.length() > 30, is(true));
+
+ String decodedRawXml = StringEscapeUtils.unescapeXml(rawDoc);
+ String decodedDoc = StringEscapeUtils.unescapeXml(document);
+
+ assertThat(decodedDoc, containsString(decodedRawXml));
}
@Test public void testCData() throws Exception {