Repository: jena
Updated Branches:
  refs/heads/JENA-380 4ae18d1ec -> 11d2d0e36


JENA-380 Migrating tests from JUnit 3 to JUnit 4


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

Branch: refs/heads/JENA-380
Commit: 11d2d0e36112d9c4f24fd913691fe086b3cda20a
Parents: 4ae18d1
Author: Bruno P. Kinoshita <[email protected]>
Authored: Tue Apr 21 17:40:59 2015 +1200
Committer: Bruno P. Kinoshita <[email protected]>
Committed: Tue Apr 21 17:40:59 2015 +1200

----------------------------------------------------------------------
 .../hp/hpl/jena/sparql/ARQTestRefEngine.java    |   8 +-
 .../reasoner/test/TS_TransitiveGraphCache.java  |  28 +++++
 .../reasoner/test/TestTransitiveGraphCache.java | 109 +++++++++----------
 .../com/hp/hpl/jena/reasoner/test/TestUtil.java |  67 +++++++++++-
 .../security/contract/model/SecTestPackage.java |   8 --
 .../contract/model/TS_SecTestPackage.java       |  27 +++++
 .../hp/hpl/jena/tdb/junit/TS_TDBScripts.java    |  26 +++++
 7 files changed, 204 insertions(+), 69 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/11d2d0e3/jena-arq/src/test/java/com/hp/hpl/jena/sparql/ARQTestRefEngine.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/com/hp/hpl/jena/sparql/ARQTestRefEngine.java 
b/jena-arq/src/test/java/com/hp/hpl/jena/sparql/ARQTestRefEngine.java
index 9eec7d7..26e364c 100644
--- a/jena-arq/src/test/java/com/hp/hpl/jena/sparql/ARQTestRefEngine.java
+++ b/jena-arq/src/test/java/com/hp/hpl/jena/sparql/ARQTestRefEngine.java
@@ -18,7 +18,9 @@
 
 package com.hp.hpl.jena.sparql;
 
-import junit.framework.TestCase ;
+import org.junit.runner.RunWith;
+import org.junit.runners.AllTests;
+
 import junit.framework.TestSuite ;
 
 import com.hp.hpl.jena.sparql.engine.ref.QueryEngineRef ;
@@ -26,8 +28,8 @@ import com.hp.hpl.jena.sparql.expr.E_Function ;
 import com.hp.hpl.jena.sparql.expr.NodeValue ;
 import com.hp.hpl.jena.sparql.junit.ScriptTestSuiteFactory ;
 
-
-public class ARQTestRefEngine extends TestCase
+@RunWith(AllTests.class)
+public class ARQTestRefEngine
 {
     public static TestSuite suite()
     {

http://git-wip-us.apache.org/repos/asf/jena/blob/11d2d0e3/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TS_TransitiveGraphCache.java
----------------------------------------------------------------------
diff --git 
a/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TS_TransitiveGraphCache.java
 
b/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TS_TransitiveGraphCache.java
new file mode 100644
index 0000000..837231a
--- /dev/null
+++ 
b/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TS_TransitiveGraphCache.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.hp.hpl.jena.reasoner.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses(TestTransitiveGraphCache.class)
+public class TS_TransitiveGraphCache {
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/11d2d0e3/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestTransitiveGraphCache.java
----------------------------------------------------------------------
diff --git 
a/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestTransitiveGraphCache.java
 
b/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestTransitiveGraphCache.java
index 747c23e..aa70b19 100644
--- 
a/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestTransitiveGraphCache.java
+++ 
b/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestTransitiveGraphCache.java
@@ -18,21 +18,22 @@
 
 package com.hp.hpl.jena.reasoner.test;
 
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
 import com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveGraphCache;
 import com.hp.hpl.jena.reasoner.TriplePattern;
-import  com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.NodeFactory ;
-import  com.hp.hpl.jena.graph.Triple;
-
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.NodeFactory;
+import com.hp.hpl.jena.graph.Triple;
 
 /**
  * A purely temporary test suite just used during development and kept
  * off the main unit test paths.
  */
 
-public class TestTransitiveGraphCache extends TestCase {
+public class TestTransitiveGraphCache {
     
     /** The cache under test */
     TransitiveGraphCache cache;
@@ -51,27 +52,10 @@ public class TestTransitiveGraphCache extends TestCase {
     Node g = NodeFactory.createURI(NS+"g");
      
     /**
-     * Boilerplate for junit
-     */ 
-    public TestTransitiveGraphCache( String name ) {
-        super( name ); 
-    }
-    
-    /**
-     * Boilerplate for junit.
-     * This is its own test suite
-     */
-    public static TestSuite suite() {
-        return new TestSuite( TestTransitiveGraphCache.class ); 
-//        TestSuite suite = new TestSuite();
-//        suite.addTest( new 
TestTransitiveGraphCache("testEquivalencesSimple"));
-//        return suite;
-    }  
-
-    /**
      * Test the basic functioning a Transitive closure cache.
      * Caches the graph but not the final closure.
      */
+    @Test
     public void testBasicCache() {
         initCache();
         cache.setCaching(false);
@@ -82,6 +66,7 @@ public class TestTransitiveGraphCache extends TestCase {
      * Test the basic functioning a Transitive closure cache.
      * Caches the graph and any requested closures
      */
+    @Test
     public void testCachingCache() {
         initCache();
         cache.setCaching(true);
@@ -91,6 +76,7 @@ public class TestTransitiveGraphCache extends TestCase {
     /**
      * Test the clone operation
      */
+    @Test
     public void testCloning() {
         initCache();
         TransitiveGraphCache clone = cache.deepCopy();
@@ -129,13 +115,13 @@ public class TestTransitiveGraphCache extends TestCase {
             
     public void doBasicTest(TransitiveGraphCache cache) {
          // Test forward property patterns
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache",
             cache.find(new TriplePattern(a, directP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
                 new Triple(a, closedP, b)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, closedP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -145,21 +131,21 @@ public class TestTransitiveGraphCache extends TestCase {
                 new Triple(a, closedP, f),
                 new Triple(a, closedP, g)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, closedP, g)),
             new Object[] {
                 new Triple(a, closedP, g),
             });
             
         // Test backward patterns
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(null, directP, f)),
             new Object[] {
                 new Triple(e, closedP, f),
                 new Triple(f, closedP, f),
                 new Triple(c, closedP, f)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(null, closedP, f)),
             new Object[] {
                 new Triple(f, closedP, f),
@@ -171,7 +157,7 @@ public class TestTransitiveGraphCache extends TestCase {
             });
         
         // List all cases
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(null, directP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -189,7 +175,7 @@ public class TestTransitiveGraphCache extends TestCase {
                 new Triple(f, closedP, g),
                 new Triple(g, closedP, g)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(null, closedP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -223,28 +209,28 @@ public class TestTransitiveGraphCache extends TestCase {
         // Add a look in the graph and check the loop from each starting 
position
         cache.addRelation(new Triple(g, closedP, e));
         
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(e, directP, null)),
                 new Object[] {
                     new Triple(e, closedP, e),
                     new Triple(e, closedP, f),
                     new Triple(e, closedP, g)
                 });
-            TestUtil.assertIteratorValues(this, 
+            TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(f, directP, null)),
                 new Object[] {
                     new Triple(f, closedP, f),
                     new Triple(f, closedP, g),
                     new Triple(f, closedP, e)
                 });
-            TestUtil.assertIteratorValues(this, 
+            TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(g, directP, null)),
                 new Object[] {
                     new Triple(g, closedP, g),
                     new Triple(g, closedP, e),
                     new Triple(g, closedP, f)
                 });
-            TestUtil.assertIteratorValues(this, 
+            TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                     cache.find(new TriplePattern(null, directP, e)),
                     new Object[] {
                         new Triple(e, closedP, e),
@@ -253,7 +239,7 @@ public class TestTransitiveGraphCache extends TestCase {
                         new Triple(c, closedP, e),
                         new Triple(g, closedP, e)
                     });
-                TestUtil.assertIteratorValues(this, 
+                TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                     cache.find(new TriplePattern(null, directP, f)),
                     new Object[] {
                         new Triple(f, closedP, f),
@@ -262,7 +248,7 @@ public class TestTransitiveGraphCache extends TestCase {
                         new Triple(c, closedP, f),
                         new Triple(e, closedP, f)
                     });
-                TestUtil.assertIteratorValues(this, 
+                TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                     cache.find(new TriplePattern(null, directP, g)),
                     new Object[] {
                         new Triple(g, closedP, g),
@@ -271,21 +257,21 @@ public class TestTransitiveGraphCache extends TestCase {
                         new Triple(c, closedP, g),
                         new Triple(f, closedP, g)
                     });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(g, closedP, null)),
             new Object[] {
                 new Triple(g, closedP, g),
                 new Triple(g, closedP, e),
                 new Triple(g, closedP, f)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(e, closedP, null)),
             new Object[] {
                 new Triple(e, closedP, g),
                 new Triple(e, closedP, e),
                 new Triple(e, closedP, f)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(f, closedP, null)),
             new Object[] {
                 new Triple(f, closedP, g),
@@ -308,13 +294,14 @@ public class TestTransitiveGraphCache extends TestCase {
      * Test a a case where an earlier version had a bug due to removing
      * a link which was required rather than redundant.
      */
+    @Test
     public void testBug1() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));  
         cache.addRelation(new Triple(c, closedP, a));        
         cache.addRelation(new Triple(c, closedP, b));
         cache.addRelation(new Triple(a, closedP, c));     
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, directP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -330,12 +317,13 @@ public class TestTransitiveGraphCache extends TestCase {
      * form a linear chain, with all closed links provided. But inserted
      * in a particular order.
      */
+    @Test
     public void testBug2() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));
         cache.addRelation(new Triple(a, closedP, c));
         cache.addRelation(new Triple(b, closedP, c));        
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, directP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -347,6 +335,7 @@ public class TestTransitiveGraphCache extends TestCase {
     /**
      * Test the removeRelation functionality.
      */
+    @Test
     public void testRemove() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));
@@ -354,7 +343,7 @@ public class TestTransitiveGraphCache extends TestCase {
         cache.addRelation(new Triple(b, closedP, d));
         cache.addRelation(new Triple(c, closedP, d));
         cache.addRelation(new Triple(d, closedP, e));
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, closedP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -364,7 +353,7 @@ public class TestTransitiveGraphCache extends TestCase {
                 new Triple(a, closedP, d),
                 new Triple(a, closedP, e)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(b, closedP, null)),
             new Object[] {
                 new Triple(b, closedP, b),
@@ -372,7 +361,7 @@ public class TestTransitiveGraphCache extends TestCase {
                 new Triple(b, closedP, e)
             });
         cache.removeRelation(new Triple(b, closedP, d));
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, closedP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -382,19 +371,19 @@ public class TestTransitiveGraphCache extends TestCase {
                 new Triple(a, closedP, d),
                 new Triple(a, closedP, e)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(b, closedP, null)),
             new Object[] {
                 new Triple(b, closedP, b),
             });
         cache.removeRelation(new Triple(a, closedP, c));
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, closedP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
                 new Triple(a, closedP, b)
             });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(b, closedP, null)),
             new Object[] {
                 new Triple(b, closedP, b),
@@ -404,13 +393,14 @@ public class TestTransitiveGraphCache extends TestCase {
     /**
      * Test direct link case with adverse ordering.
      */
+    @Test
     public void testDirect() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));
         cache.addRelation(new Triple(c, closedP, d));
         cache.addRelation(new Triple(a, closedP, d));
         cache.addRelation(new Triple(b, closedP, c));
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, directP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -421,13 +411,14 @@ public class TestTransitiveGraphCache extends TestCase {
     /**
      * Test cycle detection.
      */
+    @Test
     public void testCycle() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));
         cache.addRelation(new Triple(b, closedP, c));
         cache.addRelation(new Triple(a, closedP, c));
         cache.addRelation(new Triple(c, closedP, b));
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
             cache.find(new TriplePattern(a, directP, null)),
             new Object[] {
                 new Triple(a, closedP, a),
@@ -439,6 +430,7 @@ public class TestTransitiveGraphCache extends TestCase {
     /**
      * A ring of three cycle
      */
+    @Test
     public void testCycle2() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));
@@ -450,7 +442,7 @@ public class TestTransitiveGraphCache extends TestCase {
         cache.addRelation(new Triple(d, closedP, e));
         cache.addRelation(new Triple(c, closedP, e));
         cache.addRelation(new Triple(c, closedP, b));
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(c, directP, null)),
                 new Object[] {
                     new Triple(c, closedP, e),
@@ -459,7 +451,7 @@ public class TestTransitiveGraphCache extends TestCase {
                     new Triple(c, closedP, d),
                     new Triple(c, closedP, c),
                 });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(null, directP, c)),
                 new Object[] {
                     new Triple(a, closedP, c),
@@ -468,7 +460,7 @@ public class TestTransitiveGraphCache extends TestCase {
                     new Triple(f, closedP, c),
                     new Triple(c, closedP, c),
                 });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(f, closedP, null)),
                 new Object[] {
                     new Triple(f, closedP, f),
@@ -483,6 +475,7 @@ public class TestTransitiveGraphCache extends TestCase {
     /**
      * Two ring-of-three cycles joined at two points
      */
+    @Test
     public void testCycle3() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));
@@ -493,7 +486,7 @@ public class TestTransitiveGraphCache extends TestCase {
         cache.addRelation(new Triple(f, closedP, d));
         cache.addRelation(new Triple(b, closedP, d));
         cache.addRelation(new Triple(f, closedP, c));
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(a, directP, null)),
                 new Object[] {
                 new Triple(a, closedP, a),
@@ -503,7 +496,7 @@ public class TestTransitiveGraphCache extends TestCase {
                 new Triple(a, closedP, e),
                 new Triple(a, closedP, f),
                 });
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(null, directP, a)),
                 new Object[] {
                 new Triple(a, closedP, a),
@@ -518,11 +511,12 @@ public class TestTransitiveGraphCache extends TestCase {
     /**
      * Test simple equivalences case
      */
+    @Test
     public void testEquivalencesSimple() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));
         cache.addRelation(new Triple(b, closedP, a));
-        TestUtil.assertIteratorValues(this, 
+        TestUtil.assertIteratorValues(TestTransitiveGraphCache.class, 
"TestTransitiveGraphCache", 
                 cache.find(new TriplePattern(null, closedP, null)),
                 new Object[] {
                 new Triple(a, closedP, b),
@@ -536,6 +530,7 @@ public class TestTransitiveGraphCache extends TestCase {
     /**
      * Test equivalences case
      */
+    @Test
     public void testEquivalences() {
         TransitiveGraphCache cache = new TransitiveGraphCache(directP, 
closedP);
         cache.addRelation(new Triple(a, closedP, b));

http://git-wip-us.apache.org/repos/asf/jena/blob/11d2d0e3/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestUtil.java
----------------------------------------------------------------------
diff --git 
a/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestUtil.java 
b/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestUtil.java
index 8023e82..cd08396 100644
--- a/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestUtil.java
+++ b/jena-core/src/test/java/com/hp/hpl/jena/reasoner/test/TestUtil.java
@@ -96,7 +96,72 @@ public class TestUtil {
         // check we got the right no. of anons
         Assert.assertEquals( testCase.getName() + " iterator test did not find 
the right number of anon. nodes", countAnon, anonFound );
     }
-    
+
+    /**
+     * Helper method to test an iterator against a list of objects - order 
independent
+     * @param testCaseClass The test case class
+     * @param testCaseName The test case name
+     * @param it The iterator to test
+     * @param vals The expected values of the iterator
+     */
+    public static void assertIteratorValues(Class<?> testCaseClass, String 
testCaseName, Iterator<?> it, Object[] vals) {
+        assertIteratorValues(testCaseClass, testCaseName, it, vals, 0);
+    }
+
+    /**
+     * Helper method to test an iterator against a list of objects - order 
independent, and
+     * can optionally check the count of anonymous resources.  This allows us 
to test a 
+     * iterator of resource values which includes both URI nodes and bNodes. 
+     * @param testCaseClass The test case class
+     * @param testCaseName The test case name
+     * @param it The iterator to test
+     * @param vals The expected values of the iterator
+     * @param countAnon If non zero, count the number of anonymous resources 
returned by <code>it</code>,
+     * and don't check these resources against the expected <code>vals</code>.
+     */
+    public static void assertIteratorValues(Class<?> testCaseClass, String 
testCaseName, Iterator<?> it, Object[] vals, int countAnon) {
+        Logger logger = LoggerFactory.getLogger(testCaseClass);
+        
+        boolean[] found = new boolean[vals.length];
+        int anonFound = 0;
+        
+        for (int i = 0; i < vals.length; i++) found[i] = false;
+        
+        
+        while (it.hasNext()) {
+            Object n = it.next();
+            boolean gotit = false;
+            
+            // do bNodes separately
+            if (countAnon > 0 && isAnonValue( n )) {
+                anonFound++;
+                continue;
+            }
+            
+            for (int i = 0; i < vals.length; i++) {
+                if (n.equals(vals[i])) {
+                    gotit = true;
+                    found[i] = true;
+                }
+            }
+            if (!gotit) {
+                logger.debug(testCaseName + " found unexpected iterator value: 
" + n);
+            }
+            Assert.assertTrue(testCaseName + " found unexpected iterator 
value: " + n, gotit);
+        }
+        
+        // check that no expected values were unfound
+        for (int i = 0; i < vals.length; i++) {
+            if (!found[i]) {
+//                for (int j = 0; j < vals.length; j += 1) System.err.println( 
"#" + j + ": " + vals[j] );
+                logger.debug(testCaseName + " failed to find expected iterator 
value: " + vals[i]);
+            }
+            Assert.assertTrue(testCaseName + " failed to find expected 
iterator value: " + vals[i], found[i]);
+        }
+        
+        // check we got the right no. of anons
+        Assert.assertEquals(testCaseName + " iterator test did not find the 
right number of anon. nodes", countAnon, anonFound );
+    }
 
     /**
      * Replace all blocks of white space by a single space character, just

http://git-wip-us.apache.org/repos/asf/jena/blob/11d2d0e3/jena-security/src/test/java/org/apache/jena/security/contract/model/SecTestPackage.java
----------------------------------------------------------------------
diff --git 
a/jena-security/src/test/java/org/apache/jena/security/contract/model/SecTestPackage.java
 
b/jena-security/src/test/java/org/apache/jena/security/contract/model/SecTestPackage.java
index 7ecc713..1eb41c3 100644
--- 
a/jena-security/src/test/java/org/apache/jena/security/contract/model/SecTestPackage.java
+++ 
b/jena-security/src/test/java/org/apache/jena/security/contract/model/SecTestPackage.java
@@ -28,8 +28,6 @@ import com.hp.hpl.jena.util.FileUtils;
 
 import java.lang.reflect.InvocationTargetException;
 
-import junit.framework.TestSuite;
-
 import org.apache.jena.atlas.web.TypedInputStream;
 import org.apache.jena.riot.system.stream.Locator;
 import org.apache.jena.riot.system.stream.StreamManager;
@@ -40,14 +38,8 @@ import org.apache.jena.security.SecurityEvaluator;
 /**
  * Test package to test Model implementation.
  */
-//@RunWith(ModelTestSuite.class)
 public class SecTestPackage extends AbstractTestPackage
 {
-       static public TestSuite suite() throws SecurityException, 
IllegalArgumentException, NoSuchMethodException, InstantiationException, 
IllegalAccessException, InvocationTargetException
-       {
-               return new SecTestPackage();
-       }
-       
        public SecTestPackage() throws SecurityException, 
IllegalArgumentException, NoSuchMethodException, InstantiationException, 
IllegalAccessException, InvocationTargetException
        {
                super("SecuredModel", new PlainModelFactory() );

http://git-wip-us.apache.org/repos/asf/jena/blob/11d2d0e3/jena-security/src/test/java/org/apache/jena/security/contract/model/TS_SecTestPackage.java
----------------------------------------------------------------------
diff --git 
a/jena-security/src/test/java/org/apache/jena/security/contract/model/TS_SecTestPackage.java
 
b/jena-security/src/test/java/org/apache/jena/security/contract/model/TS_SecTestPackage.java
new file mode 100644
index 0000000..be63217
--- /dev/null
+++ 
b/jena-security/src/test/java/org/apache/jena/security/contract/model/TS_SecTestPackage.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.security.contract.model;
+
+import org.junit.runners.Suite.SuiteClasses;
+
+//@RunWith(ModelTestSuite.class)
+@SuiteClasses({SecTestPackage.class})
+public class TS_SecTestPackage {
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/11d2d0e3/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/junit/TS_TDBScripts.java
----------------------------------------------------------------------
diff --git 
a/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/junit/TS_TDBScripts.java 
b/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/junit/TS_TDBScripts.java
new file mode 100644
index 0000000..e9f24e2
--- /dev/null
+++ b/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/junit/TS_TDBScripts.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.hp.hpl.jena.tdb.junit;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+public class TS_TDBScripts {
+
+}

Reply via email to