commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [7/9] commons-rdf git commit: COMMONSRDF-55: Test asGeneralizedQuad() with default graph
Date Wed, 08 Feb 2017 14:42:16 GMT
COMMONSRDF-55: Test asGeneralizedQuad() with default graph

Project: http://git-wip-us.apache.org/repos/asf/commons-rdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rdf/commit/8dd1c430
Tree: http://git-wip-us.apache.org/repos/asf/commons-rdf/tree/8dd1c430
Diff: http://git-wip-us.apache.org/repos/asf/commons-rdf/diff/8dd1c430

Branch: refs/heads/master
Commit: 8dd1c4302c088abac74855a84b180e85d84f7410
Parents: c90bafe
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Wed Feb 8 14:37:19 2017 +0000
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Wed Feb 8 14:37:19 2017 +0000

----------------------------------------------------------------------
 .../rdf/jena/GeneralizedRDFQuadTest.java        | 21 +++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/8dd1c430/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFQuadTest.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFQuadTest.java b/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFQuadTest.java
index 1e183d3..aa81cf5 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFQuadTest.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFQuadTest.java
@@ -17,11 +17,12 @@
  */
 package org.apache.commons.rdf.jena;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 import org.apache.commons.rdf.api.BlankNode;
+import org.apache.commons.rdf.api.RDFTerm;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
 import org.apache.jena.sparql.core.Quad;
 import org.junit.Test;
 
@@ -92,6 +93,19 @@ public class GeneralizedRDFQuadTest {
         assertTrue(q.asJenaQuad().isDefaultGraph());
     }
 
+    @Test
+    public void asGeneralizedQuad() throws Exception {
+        Node s = NodeFactory.createLiteral("Hello");
+        Node p = NodeFactory.createBlankNode();
+        Node o = NodeFactory.createURI("http://example.com/ex");
+        Node g = Quad.defaultGraphIRI;
+        Quad jq = Quad.create(g, s, p, o);
+        JenaQuadLike<RDFTerm> q = jena.asGeneralizedQuad(jq);
+        assertEquals(jena.createLiteral("Hello"), q.getSubject());
+        assertEquals(jena.asRDFTerm(p), q.getPredicate());
+        assertEquals(jena.createIRI("http://example.com/ex"), q.getObject());
+        assertFalse(q.getGraphName().isPresent());
+    }
     
     @Test
     public void literalGraph() throws Exception {
@@ -109,4 +123,5 @@ public class GeneralizedRDFQuadTest {
     }
     
     
+    
 }


Mime
View raw message