jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [03/11] jena git commit: Fix up testAPI1() to test by value, not identity
Date Wed, 17 Aug 2016 16:01:36 GMT
Fix up testAPI1() to test by value, not identity


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

Branch: refs/heads/master
Commit: af5c29278b1ce801ce4c26a9d18e58433fbbbce0
Parents: f376803
Author: Andy Seaborne <andy@apache.org>
Authored: Thu Aug 11 13:11:16 2016 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Sat Aug 13 15:08:01 2016 +0100

----------------------------------------------------------------------
 .../org/apache/jena/sparql/api/TestAPI.java     | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/af5c2927/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java
index 9d387fc..c25a28f 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/api/TestAPI.java
@@ -19,6 +19,7 @@
 package org.apache.jena.sparql.api;
 
 import java.util.Iterator;
+import java.util.Set ;
 
 import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.junit.BaseTest;
@@ -95,13 +96,18 @@ public class TestAPI extends BaseTest
         }
     }
 
-    // This test is slightly dubious. It is testing that the model for the
-    // resource in the result is the same object as the model supplied ot the
-    // query.
-    //
-    // It happens to be true for DatasetImpl and the default model but that's
-    // about it. It is not part of the contract of query/datasets.
+    // The original test (see commented out "assertSame) is test is now bogus.
+    // DatasetImpl no longer caches the default model as that caused problems.
     //
+    // This is testing that the model for the resource in the result is the
+    // same object as the model supplied to the query.
+    // "Same" here means "same contents" includign blank nodes.
+    // 
+    // it used to be that this tested whether they were the same object. 
+    // That is dubious and no longer true even for DatasetImpl (teh default mode
+    // is not cached but recreated on demand so theer are no problems with
+    // transaction boundaries).    
+    // 
     // Left as an active test so the assumption is tested (it has been true for
     // many years). 
     //
@@ -115,7 +121,10 @@ public class TestAPI extends BaseTest
             assertTrue("No results", rs.hasNext()) ;
             QuerySolution qs = rs.nextSolution() ;
             Resource qr = qs.getResource("s") ;
-            assertSame("Not the same model as queried", qr.getModel(), m) ;
+            //assertSame("Not the same model as queried", qr.getModel(), m) ;
+            Set<Statement> s1 = qr.getModel().listStatements().toSet() ;
+            Set<Statement> s2 = m.listStatements().toSet() ;
+            assertEquals(s1,s2) ;
         }
     }
     


Mime
View raw message