Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 33E4D200B65 for ; Wed, 17 Aug 2016 18:01:36 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 32929160AC5; Wed, 17 Aug 2016 16:01:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 78CDC160A8C for ; Wed, 17 Aug 2016 18:01:35 +0200 (CEST) Received: (qmail 31034 invoked by uid 500); 17 Aug 2016 16:01:34 -0000 Mailing-List: contact commits-help@jena.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jena.apache.org Delivered-To: mailing list commits@jena.apache.org Received: (qmail 31009 invoked by uid 99); 17 Aug 2016 16:01:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Aug 2016 16:01:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 78E2CE07F6; Wed, 17 Aug 2016 16:01:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: andy@apache.org To: commits@jena.apache.org Date: Wed, 17 Aug 2016 16:01:36 -0000 Message-Id: <5cf3d5e0ed0649c1b32a65e71a7d63f4@git.apache.org> In-Reply-To: <7ab16ab0be134aa9b4158a0e917de720@git.apache.org> References: <7ab16ab0be134aa9b4158a0e917de720@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/11] jena git commit: Fix up testAPI1() to test by value, not identity archived-at: Wed, 17 Aug 2016 16:01:36 -0000 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 Authored: Thu Aug 11 13:11:16 2016 +0100 Committer: Andy Seaborne 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 s1 = qr.getModel().listStatements().toSet() ; + Set s2 = m.listStatements().toSet() ; + assertEquals(s1,s2) ; } }