You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by de...@apache.org on 2020/01/02 08:06:54 UTC
[cxf] 02/02: improved test assertions
This is an automated email from the ASF dual-hosted git repository.
deki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 325ed0436bc9cfa9150b3504a54b5911b47e3266
Author: Dennis Kieselhorst <de...@apache.org>
AuthorDate: Thu Jan 2 09:06:16 2020 +0100
improved test assertions
---
parent/pom.xml | 2 +-
.../org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/parent/pom.xml b/parent/pom.xml
index 58c175c..93e8460 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -149,7 +149,7 @@
<cxf.jettison.version>1.4.0</cxf.jettison.version>
<cxf.jetty.osgi.version>[9.2,10)</cxf.jetty.osgi.version>
<cxf.jetty.version>${cxf.jetty9.version}</cxf.jetty.version>
- <cxf.jetty9.version>9.4.24.v20191120</cxf.jetty9.version>
+ <cxf.jetty9.version>9.4.24.v20191120</cxf.jetty9.version><!-- 9.4.25 will break JAXRSRequestDispatcherTest.testGetBookHTMLInclude -->
<cxf.jexl.version>3.1</cxf.jexl.version>
<cxf.joda.time.version>2.9.4</cxf.joda.time.version>
<cxf.johnzon.version>1.1.13</cxf.johnzon.version>
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
index d2f5c2c..ce005aa 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
@@ -22,6 +22,8 @@ package org.apache.cxf.systest.jaxrs;
import java.util.HashMap;
import java.util.Map;
+import javax.ws.rs.core.MediaType;
+
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.ext.xml.XMLSource;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -31,6 +33,7 @@ import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class JAXRSRequestDispatcherTest extends AbstractBusClientServerTestBase {
@@ -65,8 +68,10 @@ public class JAXRSRequestDispatcherTest extends AbstractBusClientServerTestBase
namespaces.put("books", "http://www.w3.org/books");
String value = source.getValue("xhtml:html/xhtml:body/xhtml:ul/books:bookTag", namespaces);
assertEquals("CXF Rocks", value);
- String ct = client.getResponse().getMetadata().getFirst("Content-Type").toString();
- assertEquals("text/html", ct);
+ Object contentType = client.getResponse().getMetadata().getFirst("Content-Type");
+ assertNotNull("Content-Type should be present", contentType);
+ assertEquals("text/html", contentType.toString());
+ assertEquals(MediaType.TEXT_HTML_TYPE, client.getResponse().getMediaType());
}
@Test