commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [5/5] commons-rdf git commit: Test asGeneralizedTriple
Date Wed, 08 Feb 2017 14:39:02 GMT
Test asGeneralizedTriple

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

Branch: refs/heads/COMMONSRDF-55
Commit: 71833695488bec404b433bd4e2f817021232855d
Parents: 8dd1c43
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Wed Feb 8 14:38:25 2017 +0000
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Wed Feb 8 14:38:36 2017 +0000

----------------------------------------------------------------------
 .../rdf/jena/GeneralizedRDFTripleTest.java       | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/71833695/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFTripleTest.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFTripleTest.java
b/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFTripleTest.java
index 82ccb81..97abbe5 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFTripleTest.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/GeneralizedRDFTripleTest.java
@@ -17,9 +17,13 @@
  */
 package org.apache.commons.rdf.jena;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.rdf.api.BlankNode;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.graph.Triple;
 import org.junit.Test;
 
 public class GeneralizedRDFTripleTest {
@@ -66,7 +70,16 @@ public class GeneralizedRDFTripleTest {
         assertTrue(t.asJenaTriple().getSubject().isLiteral());
     }
     
-    
-
+    @Test
+    public void asGeneralizedTriple() throws Exception {
+        Node s = NodeFactory.createLiteral("Hello");
+        Node p = NodeFactory.createBlankNode();
+        Node o = NodeFactory.createURI("http://example.com/ex");
+        Triple jt = Triple.create(s, p, o);
+        JenaTripleLike t = jena.asGeneralizedTriple(jt);
+        assertEquals(jena.createLiteral("Hello"), t.getSubject());
+        assertEquals(jena.asRDFTerm(p), t.getPredicate());
+        assertEquals(jena.createIRI("http://example.com/ex"), t.getObject());
+    }
     
 }


Mime
View raw message