Repository: marmotta
Updated Branches:
  refs/heads/develop a377e5e00 -> ef38b4658


added test for marmotta-618

Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/ef38b465
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/ef38b465
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/ef38b465

Branch: refs/heads/develop
Commit: ef38b4658ee0d3a38481cfaed21071be10951b66
Parents: a377e5e
Author: Dietmar <[email protected]>
Authored: Fri Oct 2 13:33:50 2015 +0200
Committer: Dietmar <[email protected]>
Committed: Fri Oct 2 13:33:50 2015 +0200

----------------------------------------------------------------------
 .../commons/http/MarmottaHttpUtilsTest.java     | 27 ++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/ef38b465/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
 
b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
index 2c19b47..dffcefe 100644
--- 
a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
+++ 
b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/http/MarmottaHttpUtilsTest.java
@@ -19,6 +19,8 @@ package org.apache.marmotta.commons.http;
 
 import static org.junit.Assert.assertEquals;
 
+import java.util.List;
+
 import org.junit.Test;
 
 import com.google.common.collect.ImmutableList;
@@ -37,4 +39,29 @@ public class MarmottaHttpUtilsTest {
         assertEquals(null, 
MarmottaHttpUtils.bestContentType(ImmutableList.of(new ContentType("text", 
"tutle")), ImmutableList.of(new ContentType("text", "plain"))));
     }
 
+    @Test
+    public void testParseAcceptHeader() throws Exception {
+       List<ContentType> acceptedTypes = MarmottaHttpUtils.parseAcceptHeaders( 
ImmutableList.of(
+                         "application/n-triples;q=0.7,"
+                       + " text/plain;q=0.7,"
+                       + " application/rdf+xml;q=0.8,"
+                       + " application/xml;q=0.8,"
+                       + " text/turtle,"
+                       + " application/x-turtle,"
+                       + " application/trig;q=0.8,"
+                       + " application/x-trig;q=0.8"));
+       List<ContentType> offeredTypes = 
MarmottaHttpUtils.parseAcceptHeaders(ImmutableList.of(
+                       "application/ld+json; q=1.0",
+                       "application/x-turtle; q=1.0",
+                       "application/x-trig; q=1.0",
+                       "application/rdf+xml; q=1.0",
+                       "text/turtle; q=1.0",
+                       "text/rdf+n3; q=1.0", 
+                       "application/trix; q=1.0", 
+                       "application/rdf+json; q=1.0", 
+                       "text/n3; q=1.0",
+                       "text/x-nquads; q=1.0"));
+       assertEquals(new ContentType("text", "turtle", 1.0), 
MarmottaHttpUtils.bestContentType(offeredTypes, acceptedTypes));
+
+    }
 }

Reply via email to