commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [4/5] incubator-commonsrdf git commit: graphToString is specific for SimpleGraph
Date Mon, 04 Apr 2016 14:50:42 GMT
graphToString is specific for SimpleGraph

Also expose the test variables to subclasses


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/73994dbf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/73994dbf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/73994dbf

Branch: refs/heads/parser-writer-interface
Commit: 73994dbfdcc08d5abbf3b3ce69fd426d98859a8f
Parents: d08c93c
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Mon Apr 4 15:26:53 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Mon Apr 4 15:29:15 2016 +0100

----------------------------------------------------------------------
 .../commons/rdf/api/AbstractGraphTest.java      | 42 +++++++-------------
 .../commons/rdf/simple/SimpleGraphTest.java     | 17 ++++++++
 2 files changed, 32 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/73994dbf/api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.java
----------------------------------------------------------------------
diff --git a/api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.java b/api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.java
index eff542e..9029cc4 100644
--- a/api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.java
+++ b/api/src/test/java/org/apache/commons/rdf/api/AbstractGraphTest.java
@@ -43,20 +43,20 @@ import org.junit.Test;
  */
 public abstract class AbstractGraphTest {
 
-    private RDFTermFactory factory;
-    private Graph graph;
-    private IRI alice;
-    private IRI bob;
-    private IRI name;
-    private IRI knows;
-    private IRI member;
-    private BlankNode bnode1;
-    private BlankNode bnode2;
-    private Literal aliceName;
-    private Literal bobName;
-    private Literal secretClubName;
-    private Literal companyName;
-    private Triple bobNameTriple;
+    protected RDFTermFactory factory;
+    protected Graph graph;
+    protected IRI alice;
+    protected IRI bob;
+    protected IRI name;
+    protected IRI knows;
+    protected IRI member;
+    protected BlankNode bnode1;
+    protected BlankNode bnode2;
+    protected Literal aliceName;
+    protected Literal bobName;
+    protected Literal secretClubName;
+    protected Literal companyName;
+    protected Triple bobNameTriple;
 
     public abstract RDFTermFactory createFactory();
 
@@ -116,19 +116,7 @@ public abstract class AbstractGraphTest {
         }
     }
 
-    @Test
-    public void graphToString() {
-        Assume.assumeNotNull(aliceName, companyName);
-        //System.out.println(graph);
-        assertTrue(graph
-                .toString()
-                .contains(
-                        "<http://example.com/alice> <http://xmlns.com/foaf/0.1/name>
\"Alice\" ."));
-        assertTrue(graph.toString().contains(
-                " <http://xmlns.com/foaf/0.1/name> \"A company\" ."));
-
-    }
-
+ 
     @Test
     public void size() throws Exception {
         assertTrue(graph.size() > 0);

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/73994dbf/simple/src/test/java/org/apache/commons/rdf/simple/SimpleGraphTest.java
----------------------------------------------------------------------
diff --git a/simple/src/test/java/org/apache/commons/rdf/simple/SimpleGraphTest.java b/simple/src/test/java/org/apache/commons/rdf/simple/SimpleGraphTest.java
index 0951942..14f14a6 100644
--- a/simple/src/test/java/org/apache/commons/rdf/simple/SimpleGraphTest.java
+++ b/simple/src/test/java/org/apache/commons/rdf/simple/SimpleGraphTest.java
@@ -17,8 +17,12 @@
  */
 package org.apache.commons.rdf.simple;
 
+import static org.junit.Assert.assertTrue;
+
 import org.apache.commons.rdf.api.AbstractGraphTest;
 import org.apache.commons.rdf.api.RDFTermFactory;
+import org.junit.Assume;
+import org.junit.Test;
 
 /**
  * Test SimpleRDFTermFactory with AbstractGraphTest
@@ -30,4 +34,17 @@ public class SimpleGraphTest extends AbstractGraphTest {
         return new SimpleRDFTermFactory();
     }
 
+    @Test
+    public void graphToString() {
+        Assume.assumeNotNull(aliceName, companyName);
+        System.out.println(graph);
+        assertTrue(graph
+                .toString()
+                .contains(
+                        "<http://example.com/alice> <http://xmlns.com/foaf/0.1/name>
\"Alice\" ."));
+        assertTrue(graph.toString().contains(
+                " <http://xmlns.com/foaf/0.1/name> \"A company\" ."));
+
+    }
+
 }


Mime
View raw message