jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cla...@apache.org
Subject svn commit: r1530718 [4/10] - in /jena/Experimental/new-test: ./ src/test/java/com/hp/hpl/jena/graph/ src/test/java/com/hp/hpl/jena/graph/compose/ src/test/java/com/hp/hpl/jena/graph/impl/ src/test/java/com/hp/hpl/jena/mem/ src/test/java/com/hp/hpl/jen...
Date Wed, 09 Oct 2013 17:16:18 GMT
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/graph/impl/WrappedGraphTest.java Wed Oct  9 17:16:15 2013
@@ -25,19 +25,24 @@ package com.hp.hpl.jena.graph.impl;
 
 import static com.hp.hpl.jena.testing_framework.GraphHelper.*;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
 
-import com.hp.hpl.jena.graph.AbstractGraphTest;
 import com.hp.hpl.jena.graph.Factory;
 import com.hp.hpl.jena.graph.Graph;
 import com.hp.hpl.jena.graph.impl.WrappedGraph;
-import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+import org.xenei.junit.contract.IProducer;
 
-public class WrappedGraphTest extends AbstractGraphTest {
+@RunWith(ContractSuite.class)
+@ContractImpl(WrappedGraph.class)
+public class WrappedGraphTest {
 
-	protected GraphProducerInterface graphProducer = new WrappedGraphSuite.GraphProducer();
+	protected IProducer<WrappedGraph> graphProducer = new WrappedGraphSuite.GraphProducer();
 
-	@Override
-	public GraphProducerInterface getGraphProducer() {
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public IProducer<WrappedGraph> getGraphProducer() {
 		return graphProducer;
 	}
 

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayBunchTest.java (from r1520822, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayBunchTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayBunchTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java&r1=1520822&r2=1530718&rev=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayTripleBunchTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/ArrayBunchTest.java Wed Oct  9 17:16:15 2013
@@ -18,10 +18,32 @@
 
 package com.hp.hpl.jena.mem;
 
-public class ArrayTripleBunchTest extends AbstractTripleBunchTest {
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
 
-	@Override
-	public TripleBunch getBunch() {
-		return new ArrayBunch();
+import org.xenei.junit.contract.IProducer;
+
+@RunWith(ContractSuite.class)
+@ContractImpl(ArrayBunch.class)
+public class ArrayBunchTest {
+	private IProducer<ArrayBunch> producer = new IProducer<ArrayBunch>() {
+
+		@Override
+		public ArrayBunch newInstance() {
+			return new ArrayBunch();
+		}
+
+		@Override
+		public void cleanUp() {
+			// do nothing
+		}
+
+	};
+
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public IProducer<ArrayBunch> getBunchProducer() {
+		return producer;
 	}
 }

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/BunchMapContractTest.java (from r1520822, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/BunchMapContractTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/BunchMapContractTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java&r1=1520822&r2=1530718&rev=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractBunchMapTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/BunchMapContractTest.java Wed Oct  9 17:16:15 2013
@@ -23,20 +23,38 @@ import static org.mockito.Mockito.*;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
+import org.xenei.junit.contract.Contract;
 
+import org.xenei.junit.contract.IProducer;
 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 
 /**
  * Test triple bunch implementations - NOT YET FINISHED
  */
-public abstract class AbstractBunchMapTest {
+@Contract(BunchMap.class)
+public abstract class BunchMapContractTest {
+
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	protected abstract IProducer<BunchMap> getBunchMapProducer();
+
+	private BunchMap map;
 
-	protected abstract BunchMap getBunchMap();
+	@Before
+	public final void beforeAbstractBunchMapTest() {
+		map = getBunchMapProducer().newInstance();
+	}
+
+	@After
+	public final void afterAbstractBunchMapTest() {
+		getBunchMapProducer().cleanUp();
+	}
 
 	@Test
 	public void testClear() {
-		BunchMap map = getBunchMap();
 		for (int i = 0; i < 5; i++) {
 			map.put(i, mock(TripleBunch.class));
 		}
@@ -48,7 +66,6 @@ public abstract class AbstractBunchMapTe
 
 	@Test
 	public void testSize() {
-		BunchMap map = getBunchMap();
 		assertEquals(0, map.size());
 		for (int i = 0; i < 5; i++) {
 			map.put(i, mock(TripleBunch.class));
@@ -58,7 +75,6 @@ public abstract class AbstractBunchMapTe
 
 	@Test
 	public void testGet() {
-		BunchMap map = getBunchMap();
 		List<TripleBunch> lst = new ArrayList<TripleBunch>();
 		for (int i = 0; i < 5; i++) {
 			TripleBunch tb = mock(TripleBunch.class);
@@ -72,7 +88,6 @@ public abstract class AbstractBunchMapTe
 
 	@Test
 	public void testPut() {
-		BunchMap map = getBunchMap();
 		List<TripleBunch> lst = new ArrayList<TripleBunch>();
 		for (int i = 0; i < 5; i++) {
 			map.put(i, mock(TripleBunch.class));
@@ -89,7 +104,6 @@ public abstract class AbstractBunchMapTe
 
 	@Test
 	public void testRemove() {
-		BunchMap map = getBunchMap();
 		List<TripleBunch> lst = new ArrayList<TripleBunch>();
 		for (int i = 0; i < 5; i++) {
 			TripleBunch tb = mock(TripleBunch.class);
@@ -124,7 +138,6 @@ public abstract class AbstractBunchMapTe
 
 	@Test
 	public void testKeyIterator() {
-		BunchMap map = getBunchMap();
 		List<Integer> lst = new ArrayList<Integer>();
 		for (int i = 0; i < 5; i++) {
 			lst.add(i);

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphMemTest.java Wed Oct  9 17:16:15 2013
@@ -17,15 +17,17 @@
  */
 package com.hp.hpl.jena.mem;
 
-import static com.hp.hpl.jena.testing_framework.GraphHelper.graphAdd;
-import static com.hp.hpl.jena.testing_framework.GraphHelper.triple;
+import static com.hp.hpl.jena.testing_framework.GraphHelper.*;
 import static org.junit.Assert.*;
 
 import java.util.Iterator;
 
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract.Inject;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
 
-import com.hp.hpl.jena.graph.AbstractGraphTest;
 import com.hp.hpl.jena.graph.Graph;
 import com.hp.hpl.jena.graph.GraphStatisticsHandler;
 import com.hp.hpl.jena.graph.Node;
@@ -33,21 +35,31 @@ import com.hp.hpl.jena.graph.Node_URI;
 import com.hp.hpl.jena.graph.Triple;
 import com.hp.hpl.jena.graph.TripleMatch;
 import com.hp.hpl.jena.shared.JenaException;
-import com.hp.hpl.jena.testing_framework.GraphProducerInterface;
+import com.hp.hpl.jena.testing_framework.AbstractGraphProducer;
+import org.xenei.junit.contract.IProducer;
 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 
-public class GraphMemTest extends AbstractGraphTest {
+@RunWith(ContractSuite.class)
+@ContractImpl(GraphMem.class)
+public class GraphMemTest {
 
-	GraphProducerInterface graphProducer = new GraphMemSuite.GraphProducer();
+	protected IProducer<GraphMem> graphProducer = new AbstractGraphProducer<GraphMem>() {
 
-	@Override
-	public GraphProducerInterface getGraphProducer() {
+		@Override
+		protected GraphMem createNewGraph() {
+			return new GraphMem();
+		}
+
+	};
+
+	@Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public IProducer<GraphMem> getGraphProducer() {
 		return graphProducer;
 	}
 
 	@Test
 	public void testHasStatistics() {
-		GraphStatisticsHandler h = graphProducer.newGraph()
+		GraphStatisticsHandler h = graphProducer.newInstance()
 				.getStatisticsHandler();
 		assertNotNull(h);
 	}
@@ -78,7 +90,7 @@ public class GraphMemTest extends Abstra
 				return true;
 			}
 		};
-		Graph g = graphWithTxn("x p y");
+		Graph g = graphWith(graphProducer.newInstance(), "x p y");
 		g.add(new Triple(special, special, special));
 		exhaust(g.find(special, Node.ANY, Node.ANY));
 		exhaust(g.find(Node.ANY, special, Node.ANY));

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/GraphTripleStoreTest.java Wed Oct  9 17:16:15 2013
@@ -18,15 +18,34 @@
 
 package com.hp.hpl.jena.mem;
 
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
+
 import com.hp.hpl.jena.graph.Graph;
-import com.hp.hpl.jena.graph.impl.AbstractTripleStoreTest;
-import com.hp.hpl.jena.graph.impl.TripleStore;
 import com.hp.hpl.jena.mem.GraphTripleStore;
+import org.xenei.junit.contract.IProducer;
+
+@RunWith(ContractSuite.class)
+@ContractImpl(GraphTripleStore.class)
+public class GraphTripleStoreTest {
+
+	private IProducer<GraphTripleStore> producer = new IProducer<GraphTripleStore>() {
+
+		@Override
+		public GraphTripleStore newInstance() {
+			return new GraphTripleStore(Graph.emptyGraph);
+		}
+
+		@Override
+		public void cleanUp() {
+		}
 
-public class GraphTripleStoreTest extends AbstractTripleStoreTest {
+	};
 
-	@Override
-	public TripleStore getTripleStore() {
-		return new GraphTripleStore(Graph.emptyGraph);
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public IProducer<GraphTripleStore> getTripleStore() {
+		return producer;
 	}
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedBunchMapTest.java Wed Oct  9 17:16:15 2013
@@ -18,11 +18,33 @@
 
 package com.hp.hpl.jena.mem;
 
-public class HashedBunchMapTest extends AbstractBunchMapTest {
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
 
-	@Override
-	protected BunchMap getBunchMap() {
-		return new HashedBunchMap();
+import org.xenei.junit.contract.IProducer;
+
+@RunWith(ContractSuite.class)
+@ContractImpl(HashedBunchMap.class)
+public class HashedBunchMapTest {
+
+	private IProducer<HashedBunchMap> producer = new IProducer<HashedBunchMap>() {
+
+		@Override
+		public HashedBunchMap newInstance() {
+			return new HashedBunchMap();
+		}
+
+		@Override
+		public void cleanUp() {
+			// do nothing
+		}
+	};
+
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public IProducer<HashedBunchMap> getBunchMapProducer() {
+		return producer;
 	}
 
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/HashedTripleBunchTest.java Wed Oct  9 17:16:15 2013
@@ -21,16 +21,40 @@ package com.hp.hpl.jena.mem;
 import static com.hp.hpl.jena.testing_framework.GraphHelper.*;
 import static org.junit.Assert.*;
 
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
 
 import com.hp.hpl.jena.graph.Node;
 import com.hp.hpl.jena.graph.Triple;
+import org.xenei.junit.contract.IProducer;
 
-public class HashedTripleBunchTest extends AbstractTripleBunchTest {
+@RunWith(ContractSuite.class)
+@ContractImpl(HashedTripleBunch.class)
+public class HashedTripleBunchTest {
 
-	protected static class HTB extends HashedTripleBunch {
-		public HTB(TripleBunch b) {
-			super(b);
+	private HashedTripleBunch testBunch;
+
+	private IProducer<HashedTripleBunch> producer = new IProducer<HashedTripleBunch>() {
+
+		@Override
+		public HashedTripleBunch newInstance() {
+			return new HashedTripleBunch(TripleBunchContractTest.EMPTY_BUNCH);
+		}
+
+		@Override
+		public void cleanUp() {
+			// do nothing
+		}
+	};
+
+	private static class HTB extends HashedTripleBunch {
+		public HTB() {
+			super(TripleBunchContractTest.EMPTY_BUNCH);
 		}
 
 		@Override
@@ -39,14 +63,26 @@ public class HashedTripleBunchTest exten
 		}
 	}
 
-	@Override
-	public TripleBunch getBunch() {
-		return new HashedTripleBunch(emptyBunch);
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public IProducer<HashedTripleBunch> getBunchProducer() {
+		return producer;
 	}
 
-	HashedTripleBunch htb = new HTB(emptyBunch);
+	@Before
+	public final void beforeHashedTripleBunchTest() {
+		testBunch = new HTB();
+	}
+
+	@After
+	public final void afterHashedTripleBunchTest() {
+		getBunchProducer().cleanUp();
+	}
 
-	static class TripleWithHash extends Triple {
+	/**
+	 * Triple with has so we can force hash values.
+	 * 
+	 */
+	private static class TripleWithHash extends Triple {
 		final int hash;
 
 		TripleWithHash(int hash, Node s, Node p, Node o) {
@@ -68,36 +104,35 @@ public class HashedTripleBunchTest exten
 
 	@Test
 	public void testHashcodeUsedAsIndex() {
-		HashedTripleBunch htb = new HTB(emptyBunch);
-		int limit = htb.currentCapacity();
+		int limit = testBunch.currentCapacity();
 		for (int i = 0; i < limit; i += 1) {
 			TripleWithHash t = TripleWithHash.create(i, "s p o");
-			htb.add(t);
-			assertSame(t, htb.getItemForTestingAt(i));
+			testBunch.add(t);
+			assertSame(t, testBunch.getItemForTestingAt(i));
 		}
 	}
 
 	@Test
 	public void testRemovePerformsShiftFromTop() {
-		int capacity = htb.currentCapacity();
+		int capacity = testBunch.currentCapacity();
 		testRemovePerformsShift(capacity - 1, capacity);
 	}
 
 	@Test
 	public void testRemovePerformsShiftFromMiddle() {
-		int capacity = htb.currentCapacity();
+		int capacity = testBunch.currentCapacity();
 		testRemovePerformsShift(capacity - 3, capacity);
 	}
 
 	@Test
 	public void testRemovePerformsShiftWrappingLowestTwo() {
-		int capacity = htb.currentCapacity();
+		int capacity = testBunch.currentCapacity();
 		testRemovePerformsShift(0, capacity);
 	}
 
 	@Test
 	public void testRemovePerformsShiftWrappingLowest() {
-		int capacity = htb.currentCapacity();
+		int capacity = testBunch.currentCapacity();
 		testRemovePerformsShift(1, capacity);
 	}
 
@@ -111,44 +146,46 @@ public class HashedTripleBunchTest exten
 		TripleWithHash t1 = TripleWithHash.create(most, "s p o");
 		TripleWithHash t2 = TripleWithHash.create(next, "a b c");
 		TripleWithHash t3 = TripleWithHash.create(most, "x y z");
-		htb.add(t1);
-		htb.add(t2);
-		htb.add(t3);
-		assertSame(t1, htb.getItemForTestingAt(most));
-		assertSame(t2, htb.getItemForTestingAt(next));
-		assertSame(t3, htb.getItemForTestingAt(least));
+		testBunch.add(t1);
+		testBunch.add(t2);
+		testBunch.add(t3);
+		assertSame(t1, testBunch.getItemForTestingAt(most));
+		assertSame(t2, testBunch.getItemForTestingAt(next));
+		assertSame(t3, testBunch.getItemForTestingAt(least));
 		//
-		htb.remove(t1);
-		assertSame(t3, htb.getItemForTestingAt(most));
-		assertSame(t2, htb.getItemForTestingAt(next));
-		assertSame(null, htb.getItemForTestingAt(least));
+		testBunch.remove(t1);
+		assertSame(t3, testBunch.getItemForTestingAt(most));
+		assertSame(t2, testBunch.getItemForTestingAt(next));
+		assertSame(null, testBunch.getItemForTestingAt(least));
 	}
 
 	@Test
 	public void testIteratorRemovePerformsShiftAndDeliversElementFromTop() {
-		int capacity = htb.currentCapacity();
+		int capacity = testBunch.currentCapacity();
 		testIteratorRemovePerformsShiftAndDeliversElement(capacity - 1,
 				capacity);
 	}
 
 	@Test
 	public void testIteratorRemovePerformsShiftAndDeliversElementFromMiddle() {
-		int capacity = htb.currentCapacity();
+		int capacity = testBunch.currentCapacity();
 		testIteratorRemovePerformsShiftAndDeliversElement(capacity - 3,
 				capacity);
 	}
 
+	// @Test
 	// public void
 	// testIteratorRemovePerformsShiftAndDeliversElementWrappingLowest()
 	// {
-	// int capacity = htb.currentCapacity();
+	// int capacity = testBunch.currentCapacity();
 	// testIteratorRemovePerformsShiftAndDeliversElement( 1, capacity );
 	// }
 	//
+	// @Test
 	// public void
 	// testIteratorRemovePerformsShiftAndDeliversElementWrappingLowestTwo()
 	// {
-	// int capacity = htb.currentCapacity();
+	// int capacity = testBunch.currentCapacity();
 	// testIteratorRemovePerformsShiftAndDeliversElement( 0, capacity );
 	// }
 
@@ -159,10 +196,10 @@ public class HashedTripleBunchTest exten
 		// TripleWithHash t1 = TripleWithHash.create( most, "s p o" );
 		// TripleWithHash t2 = TripleWithHash.create( next, "a b c" );
 		// TripleWithHash t3 = TripleWithHash.create( most, "x y z" );
-		// htb.add( t1 );
-		// htb.add( t2 );
-		// htb.add( t3 );
-		// ExtendedIterator it = htb.iterator();
+		// testBunch.add( t1 );
+		// testBunch.add( t2 );
+		// testBunch.add( t3 );
+		// ExtendedIterator<Triple> it = testBunch.iterator();
 		// assertSame( t1, it.next() );
 		// it.remove();
 		// assertSame( t3, it.next() );

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TripleBunchContractTest.java (from r1523135, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TripleBunchContractTest.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TripleBunchContractTest.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java&r1=1523135&r2=1530718&rev=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/AbstractTripleBunchTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/TripleBunchContractTest.java Wed Oct  9 17:16:15 2013
@@ -27,114 +27,128 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
+import org.xenei.junit.contract.Contract;
 
 import com.hp.hpl.jena.graph.Triple;
+import org.xenei.junit.contract.IProducer;
 import com.hp.hpl.jena.testing_framework.NodeCreateUtils;
 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
 
 /**
  * Test triple bunch implementations - NOT YET FINISHED
  */
-public abstract class AbstractTripleBunchTest {
-	protected static final TripleBunch emptyBunch = new ArrayBunch();
+@Contract(TripleBunch.class)
+public abstract class TripleBunchContractTest {
+
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public abstract IProducer<TripleBunch> getTripleBunchProducer();
+
+	public static final TripleBunch EMPTY_BUNCH = new ArrayBunch();
+
 	protected static final Triple tripleSPO = triple("s P o");
 	protected static final Triple tripleXQY = triple("x Q y");
 
-	protected abstract TripleBunch getBunch();
+	// protected abstract TripleBunch getBunch();
+	private TripleBunch testingBunch;
+
+	@Before
+	public final void beforeAbstractTripleBunchTest() {
+		testingBunch = getTripleBunchProducer().newInstance();
+	}
+
+	@After
+	public final void afterAbstractTripleBunchTest() {
+		getTripleBunchProducer().cleanUp();
+	}
 
 	@Test
 	public void testEmptyBunch() {
-		TripleBunch b = getBunch();
-		assertEquals(0, b.size());
-		assertFalse(b.contains(tripleSPO));
-		assertFalse(b.contains(tripleXQY));
-		assertFalse(b.iterator().hasNext());
+		assertEquals(0, testingBunch.size());
+		assertFalse(testingBunch.contains(tripleSPO));
+		assertFalse(testingBunch.contains(tripleXQY));
+		assertFalse(testingBunch.iterator().hasNext());
 	}
 
 	@Test
 	public void testAddElement() {
-		TripleBunch b = getBunch();
-		b.add(tripleSPO);
-		assertEquals(1, b.size());
-		assertTrue(b.contains(tripleSPO));
-		assertEquals(listOf(tripleSPO), iteratorToList(b.iterator()));
+		testingBunch.add(tripleSPO);
+		assertEquals(1, testingBunch.size());
+		assertTrue(testingBunch.contains(tripleSPO));
+		assertEquals(listOf(tripleSPO), iteratorToList(testingBunch.iterator()));
 	}
 
 	@Test
 	public void testAddElements() {
-		TripleBunch b = getBunch();
-		b.add(tripleSPO);
-		b.add(tripleXQY);
-		assertEquals(2, b.size());
-		assertTrue(b.contains(tripleSPO));
-		assertTrue(b.contains(tripleXQY));
-		assertEquals(setOf(tripleSPO, tripleXQY), iteratorToSet(b.iterator()));
+		testingBunch.add(tripleSPO);
+		testingBunch.add(tripleXQY);
+		assertEquals(2, testingBunch.size());
+		assertTrue(testingBunch.contains(tripleSPO));
+		assertTrue(testingBunch.contains(tripleXQY));
+		assertEquals(setOf(tripleSPO, tripleXQY),
+				iteratorToSet(testingBunch.iterator()));
 	}
 
 	@Test
 	public void testRemoveOnlyElement() {
-		TripleBunch b = getBunch();
-		b.add(tripleSPO);
-		b.remove(tripleSPO);
-		assertEquals(0, b.size());
-		assertFalse(b.contains(tripleSPO));
-		assertFalse(b.iterator().hasNext());
+		testingBunch.add(tripleSPO);
+		testingBunch.remove(tripleSPO);
+		assertEquals(0, testingBunch.size());
+		assertFalse(testingBunch.contains(tripleSPO));
+		assertFalse(testingBunch.iterator().hasNext());
 	}
 
 	@Test
 	public void testRemoveFirstOfTwo() {
-		TripleBunch b = getBunch();
-		b.add(tripleSPO);
-		b.add(tripleXQY);
-		b.remove(tripleSPO);
-		assertEquals(1, b.size());
-		assertFalse(b.contains(tripleSPO));
-		assertTrue(b.contains(tripleXQY));
-		assertEquals(listOf(tripleXQY), iteratorToList(b.iterator()));
+		testingBunch.add(tripleSPO);
+		testingBunch.add(tripleXQY);
+		testingBunch.remove(tripleSPO);
+		assertEquals(1, testingBunch.size());
+		assertFalse(testingBunch.contains(tripleSPO));
+		assertTrue(testingBunch.contains(tripleXQY));
+		assertEquals(listOf(tripleXQY), iteratorToList(testingBunch.iterator()));
 	}
 
 	@Test
 	public void testTableGrows() {
-		TripleBunch b = getBunch();
-		b.add(tripleSPO);
-		b.add(tripleXQY);
-		b.add(triple("a I b"));
-		b.add(triple("c J d"));
+		testingBunch.add(tripleSPO);
+		testingBunch.add(tripleXQY);
+		testingBunch.add(triple("a I b"));
+		testingBunch.add(triple("c J d"));
 	}
 
 	@Test
 	public void testIterator() {
-		TripleBunch b = getBunch();
-		b.add(triple("a P b"));
-		b.add(triple("c Q d"));
-		b.add(triple("e R f"));
-		assertEquals(tripleSet("a P b; c Q d; e R f"), b.iterator().toSet());
+		testingBunch.add(triple("a P b"));
+		testingBunch.add(triple("c Q d"));
+		testingBunch.add(triple("e R f"));
+		assertEquals(tripleSet("a P b; c Q d; e R f"), testingBunch.iterator()
+				.toSet());
 	}
 
 	@Test
 	public void testIteratorRemoveOneItem() {
-		TripleBunch b = getBunch();
-		b.add(triple("a P b"));
-		b.add(triple("c Q d"));
-		b.add(triple("e R f"));
-		ExtendedIterator<Triple> it = b.iterator();
+		testingBunch.add(triple("a P b"));
+		testingBunch.add(triple("c Q d"));
+		testingBunch.add(triple("e R f"));
+		ExtendedIterator<Triple> it = testingBunch.iterator();
 		while (it.hasNext())
 			if (it.next().equals(triple("c Q d")))
 				it.remove();
-		assertEquals(tripleSet("a P b; e R f"), b.iterator().toSet());
+		assertEquals(tripleSet("a P b; e R f"), testingBunch.iterator().toSet());
 	}
 
 	@Test
 	public void testIteratorRemoveAlltems() {
-		TripleBunch b = getBunch();
-		b.add(triple("a P b"));
-		b.add(triple("c Q d"));
-		b.add(triple("e R f"));
-		ExtendedIterator<Triple> it = b.iterator();
+		testingBunch.add(triple("a P b"));
+		testingBunch.add(triple("c Q d"));
+		testingBunch.add(triple("e R f"));
+		ExtendedIterator<Triple> it = testingBunch.iterator();
 		while (it.hasNext())
 			it.removeNext();
-		assertEquals(tripleSet(""), b.iterator().toSet());
+		assertEquals(tripleSet(""), testingBunch.iterator().toSet());
 	}
 
 	protected List<Triple> listOf(Triple x) {
@@ -156,12 +170,11 @@ public abstract class AbstractTripleBunc
 	}
 
 	public void testAddThenNextThrowsCME() {
-		TripleBunch b = getBunch();
-		b.add(NodeCreateUtils.createTriple("a P b"));
-		b.add(NodeCreateUtils.createTriple("c Q d"));
-		ExtendedIterator<Triple> it = b.iterator();
+		testingBunch.add(NodeCreateUtils.createTriple("a P b"));
+		testingBunch.add(NodeCreateUtils.createTriple("c Q d"));
+		ExtendedIterator<Triple> it = testingBunch.iterator();
 		it.next();
-		b.add(NodeCreateUtils.createTriple("change its state"));
+		testingBunch.add(NodeCreateUtils.createTriple("change its state"));
 		try {
 			it.next();
 			fail("should have thrown ConcurrentModificationException");
@@ -171,12 +184,11 @@ public abstract class AbstractTripleBunc
 	}
 
 	public void testDeleteThenNextThrowsCME() {
-		TripleBunch b = getBunch();
-		b.add(NodeCreateUtils.createTriple("a P b"));
-		b.add(NodeCreateUtils.createTriple("c Q d"));
-		ExtendedIterator<Triple> it = b.iterator();
+		testingBunch.add(NodeCreateUtils.createTriple("a P b"));
+		testingBunch.add(NodeCreateUtils.createTriple("c Q d"));
+		ExtendedIterator<Triple> it = testingBunch.iterator();
 		it.next();
-		b.remove(NodeCreateUtils.createTriple("a P b"));
+		testingBunch.remove(NodeCreateUtils.createTriple("a P b"));
 		try {
 			it.next();
 			fail("should have thrown ConcurrentModificationException");

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/mem/WrappedHashMapTest.java Wed Oct  9 17:16:15 2013
@@ -18,10 +18,32 @@
 
 package com.hp.hpl.jena.mem;
 
-public class WrappedHashMapTest extends AbstractBunchMapTest {
+import org.junit.runner.RunWith;
+import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
 
-	@Override
-	public BunchMap getBunchMap() {
-		return new WrappedHashMap();
+import org.xenei.junit.contract.IProducer;
+
+@RunWith(ContractSuite.class)
+@ContractImpl(WrappedHashMap.class)
+public class WrappedHashMapTest {
+
+	private IProducer<WrappedHashMap> producer = new IProducer<WrappedHashMap>() {
+
+		@Override
+		public WrappedHashMap newInstance() {
+			return new WrappedHashMap();
+		}
+
+		@Override
+		public void cleanUp() {
+			// do nothing
+		}
+	};
+
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	public IProducer<WrappedHashMap> getBunchMapProducer() {
+		return producer;
 	}
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractFindPropertiesTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractFindPropertiesTests.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractFindPropertiesTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractFindPropertiesTests.java Wed Oct  9 17:16:15 2013
@@ -26,16 +26,12 @@ import com.hp.hpl.jena.rdf.model.RDFNode
 import com.hp.hpl.jena.rdf.model.ResIterator;
 import com.hp.hpl.jena.rdf.model.Resource;
 import com.hp.hpl.jena.rdf.model.Statement;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducerUser;
-import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
-
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public abstract class AbstractFindPropertiesTests extends AbstractModelProducerUser
-{
-	
+public abstract class AbstractFindPropertiesTests extends AbstractProducerUser {
+
 	/*
 	 * 
 	 * boolean predf[] = new boolean[num];
@@ -44,7 +40,7 @@ public abstract class AbstractFindProper
 	 * 
 	 * try {
 	 */
-	
+
 	Model model;
 
 	int num = 5;
@@ -71,54 +67,38 @@ public abstract class AbstractFindProper
 	// Literal tvLitObj[];
 	// Resource tvResObj[] =;
 
-	
-
-	private void assertFoundAll( final boolean[] subjf )
-	{
-		for (int i = 0; i < num; i++)
-		{
+	private void assertFoundAll(final boolean[] subjf) {
+		for (int i = 0; i < num; i++) {
 			Assert.assertTrue("Should have found " + subject[i], subjf[i]);
 		}
 	}
 
-	private void assertFoundNone( final boolean[] subjf )
-	{
-		for (int i = 0; i < num; i++)
-		{
+	private void assertFoundNone(final boolean[] subjf) {
+		for (int i = 0; i < num; i++) {
 			Assert.assertFalse("Should not have found " + subject[i], subjf[i]);
 		}
 	}
 
-	private void checkBooleanSubjects( final boolean[] subjf )
-	{
-		for (int i = 0; i < num; i++)
-		{
-			if (subjf[i])
-			{
+	private void checkBooleanSubjects(final boolean[] subjf) {
+		for (int i = 0; i < num; i++) {
+			if (subjf[i]) {
 				Assert.assertFalse(i > 1);
-			}
-			else
-			{
+			} else {
 				Assert.assertFalse(i < 2);
 			}
 		}
 	}
 
-	private void processIterator( final ResIterator rIter, final boolean[] subjf )
-	{
-		for (int i = 0; i < num; i++)
-		{
+	private void processIterator(final ResIterator rIter, final boolean[] subjf) {
+		for (int i = 0; i < num; i++) {
 			subjf[i] = false;
 		}
 
-		while (rIter.hasNext())
-		{
+		while (rIter.hasNext()) {
 			final Resource subj = rIter.nextResource();
 			Boolean found = false;
-			for (int i = 0; i < num; i++)
-			{
-				if (subj.equals(subject[i]))
-				{
+			for (int i = 0; i < num; i++) {
+				if (subj.equals(subject[i])) {
 					found = true;
 					Assert.assertFalse("Should not have found " + subject[i]
 							+ " already", subjf[i]);
@@ -130,30 +110,25 @@ public abstract class AbstractFindProper
 	}
 
 	@Before
-	final public void setUpAbstractFindPropertiesTests() throws Exception
-	{
+	final public void setUpAbstractFindPropertiesTests() throws Exception {
 		// tvLitObj = { model.createTypedLiteral(new LitTestObjF()),
 		// model.createTypedLiteral(new LitTestObjF()) };
 		// tvResObj = { model.createResource(new ResTestObjF()),
 		// model.createResource(new ResTestObjF()) };
 
 		model = getModelProducer().newModel();
-		for (int i = 0; i < num; i++)
-		{
+		for (int i = 0; i < num; i++) {
 			subject[i] = model.createResource(suri + Integer.toString(i));
 			predicate[i] = model
 					.createProperty(puri + Integer.toString(i), "p");
 		}
 
-		for (int i = 0; i < num; i++)
-		{
+		for (int i = 0; i < num; i++) {
 			model.addLiteral(subject[i], predicate[4], false);
 		}
 
-		for (int i = 0; i < 2; i++)
-		{
-			for (int j = 0; j < 2; j++)
-			{
+		for (int i = 0; i < 2; i++) {
+			for (int j = 0; j < 2; j++) {
 				stmt = model.createStatement(subject[i], predicate[j],
 						model.createTypedLiteral(tvBooleanArray[j]));
 				model.add(stmt);
@@ -198,19 +173,15 @@ public abstract class AbstractFindProper
 	}
 
 	@Test
-	public void testListObjectsOfProperty()
-	{
+	public void testListObjectsOfProperty() {
 		final boolean objf[] = new boolean[numObj];
 
 		final NodeIterator nIter = model.listObjectsOfProperty(predicate[1]);
-		while (nIter.hasNext())
-		{
+		while (nIter.hasNext()) {
 			final RDFNode obj = nIter.nextNode();
 			Boolean found = false;
-			for (int i = 0; i < numObj; i++)
-			{
-				if (obj.equals(object[i]))
-				{
+			for (int i = 0; i < numObj; i++) {
+				if (obj.equals(object[i])) {
 					found = true;
 					Assert.assertFalse("Should not have found " + object[i]
 							+ " already", objf[i]);
@@ -219,16 +190,14 @@ public abstract class AbstractFindProper
 			}
 			Assert.assertTrue("Should have found " + obj, found);
 		}
-		for (int i = 0; i < numObj; i++)
-		{
+		for (int i = 0; i < numObj; i++) {
 			Assert.assertTrue("Should have found " + object[i], objf[i]);
 		}
 
 	}
 
 	@Test
-	public void testListResourcesWIthProperty()
-	{
+	public void testListResourcesWIthProperty() {
 		final boolean subjf[] = new boolean[num];
 		processIterator(model.listResourcesWithProperty(predicate[4]), subjf);
 		assertFoundAll(subjf);
@@ -246,14 +215,12 @@ public abstract class AbstractFindProper
 						model.createTypedLiteral(tvBooleanArray[1])), subjf);
 		assertFoundNone(subjf);
 
-		processIterator(
-				model.listResourcesWithProperty(predicate[0], (byte) tvLongArray[0]),
-				subjf);
+		processIterator(model.listResourcesWithProperty(predicate[0],
+				(byte) tvLongArray[0]), subjf);
 		checkBooleanSubjects(subjf);
 
-		processIterator(
-				model.listResourcesWithProperty(predicate[0], (byte) tvLongArray[1]),
-				subjf);
+		processIterator(model.listResourcesWithProperty(predicate[0],
+				(byte) tvLongArray[1]), subjf);
 		assertFoundNone(subjf);
 
 		processIterator(model.listResourcesWithProperty(predicate[0],
@@ -264,30 +231,32 @@ public abstract class AbstractFindProper
 				(short) tvLongArray[1]), subjf);
 		assertFoundNone(subjf);
 
-		processIterator(
-				model.listResourcesWithProperty(predicate[0], (int) tvLongArray[0]),
-				subjf);
+		processIterator(model.listResourcesWithProperty(predicate[0],
+				(int) tvLongArray[0]), subjf);
 		checkBooleanSubjects(subjf);
 
-		processIterator(
-				model.listResourcesWithProperty(predicate[0], (int) tvLongArray[1]),
-				subjf);
+		processIterator(model.listResourcesWithProperty(predicate[0],
+				(int) tvLongArray[1]), subjf);
 		assertFoundNone(subjf);
 
 		processIterator(
-				model.listResourcesWithProperty(predicate[0], tvLongArray[0]), subjf);
+				model.listResourcesWithProperty(predicate[0], tvLongArray[0]),
+				subjf);
 		checkBooleanSubjects(subjf);
 
 		processIterator(
-				model.listResourcesWithProperty(predicate[0], tvLongArray[1]), subjf);
+				model.listResourcesWithProperty(predicate[0], tvLongArray[1]),
+				subjf);
 		assertFoundNone(subjf);
 
 		processIterator(
-				model.listResourcesWithProperty(predicate[0], tvCharArray[0]), subjf);
+				model.listResourcesWithProperty(predicate[0], tvCharArray[0]),
+				subjf);
 		checkBooleanSubjects(subjf);
 
 		processIterator(
-				model.listResourcesWithProperty(predicate[0], tvCharArray[1]), subjf);
+				model.listResourcesWithProperty(predicate[0], tvCharArray[1]),
+				subjf);
 		assertFoundNone(subjf);
 
 		processIterator(
@@ -312,8 +281,7 @@ public abstract class AbstractFindProper
 	}
 
 	@Test
-	public void testListSubjectsWithProperty()
-	{
+	public void testListSubjectsWithProperty() {
 		final boolean subjf[] = new boolean[num];
 		processIterator(
 				model.listSubjectsWithProperty(predicate[0], tvStringArray[0]),
@@ -431,5 +399,4 @@ public abstract class AbstractFindProper
 		// }
 	}
 
-	
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractIteratorTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractIteratorTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractIteratorTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractIteratorTest.java Wed Oct  9 17:16:15 2013
@@ -26,22 +26,19 @@ import com.hp.hpl.jena.rdf.model.ResIter
 import com.hp.hpl.jena.rdf.model.Resource;
 import com.hp.hpl.jena.rdf.model.Statement;
 import com.hp.hpl.jena.rdf.model.StmtIterator;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducerUser;
-import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
 import com.hp.hpl.jena.vocabulary.RDF;
 
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public abstract class AbstractIteratorTest extends AbstractModelProducerUser 
-{
+public abstract class AbstractIteratorTest extends AbstractProducerUser {
 	protected Model model;
 	private static int num = 5;
 	Resource subject[];
 	Property predicate[];
 	Statement stmts[];
-	
+
 	public static final String suri = "http://aldabaran/test6/s";
 	public static final String puri = "http://aldabaran/test6/";
 
@@ -52,24 +49,20 @@ public abstract class AbstractIteratorTe
 	}
 
 	@Before
-	final public void setupTestIterators() throws Exception
-	{
+	final public void setupTestIterators() throws Exception {
 		model = getModelProducer().newModel();
-		 subject = new Resource[num];
-		 predicate = new Property[num];
-		 stmts = new Statement[num * num];
+		subject = new Resource[num];
+		predicate = new Property[num];
+		stmts = new Statement[num * num];
 
-		for (int i = 0; i < num; i++)
-		{
+		for (int i = 0; i < num; i++) {
 			subject[i] = model.createResource(suri + Integer.toString(i));
 			predicate[i] = model
 					.createProperty(puri + Integer.toString(i), "p");
 		}
 
-		for (int i = 0; i < num; i++)
-		{
-			for (int j = 0; j < num; j++)
-			{
+		for (int i = 0; i < num; i++) {
+			for (int j = 0; j < num; j++) {
 				final Statement stmt = model.createStatement(subject[i],
 						predicate[j], model.createTypedLiteral((i * num) + j));
 				model.add(stmt);
@@ -80,38 +73,30 @@ public abstract class AbstractIteratorTe
 	}
 
 	/**
-	 * bug detected in StatementIteratorImpl - next does not
-	 * advance current, so remove doesn't work with next;
-	 * this test should expose the bug.
+	 * bug detected in StatementIteratorImpl - next does not advance current, so
+	 * remove doesn't work with next; this test should expose the bug.
 	 */
 	@Test
-	public void testIteratorRemove()
-	{
+	public void testIteratorRemove() {
 		final StmtIterator it = model.listStatements();
-		try
-		{
-			while (it.hasNext())
-			{
+		try {
+			while (it.hasNext()) {
 				it.next();
 				it.remove();
 			}
 			Assert.assertEquals("Remove failed", 0, model.size());
-		}
-		finally
-		{
+		} finally {
 			it.close();
 		}
 
 	}
 
 	@Test
-	public void testListObjects()
-	{
+	public void testListObjects() {
 		int count = 0;
 		NodeIterator iter;
 		iter = model.listObjects();
-		while (iter.hasNext())
-		{
+		while (iter.hasNext()) {
 			iter.nextNode();
 			count++;
 		}
@@ -119,22 +104,17 @@ public abstract class AbstractIteratorTe
 	}
 
 	@Test
-	public void testNamespaceIterator()
-	{
+	public void testNamespaceIterator() {
 		final boolean predf[] = new boolean[num];
-		for (int i = 0; i < num; i++)
-		{
+		for (int i = 0; i < num; i++) {
 			predf[i] = false;
 		}
 		final NsIterator nIter = model.listNameSpaces();
-		while (nIter.hasNext())
-		{
+		while (nIter.hasNext()) {
 			final String ns = nIter.nextNs();
 			boolean found = false;
-			for (int i = 0; i < num; i++)
-			{
-				if (ns.equals(predicate[i].getNameSpace()))
-				{
+			for (int i = 0; i < num; i++) {
+				if (ns.equals(predicate[i].getNameSpace())) {
 					found = true;
 					Assert.assertFalse("Should not have found " + predicate[i]
 							+ " already.", predf[i]);
@@ -143,37 +123,29 @@ public abstract class AbstractIteratorTe
 			}
 			Assert.assertTrue("Should have found " + ns, found);
 		}
-		for (int i = 0; i < num; i++)
-		{
+		for (int i = 0; i < num; i++) {
 			Assert.assertTrue("Should have found " + predicate[i], predf[i]);
 		}
 	}
 
 	@Test
-	public void testObjectsOfProperty()
-	{
+	public void testObjectsOfProperty() {
 
 		NodeIterator iter;
 		final boolean[] object = new boolean[num * num];
-		for (int i = 0; i < (num * num); i++)
-		{
+		for (int i = 0; i < (num * num); i++) {
 			object[i] = false;
 		}
 		iter = model.listObjectsOfProperty(predicate[0]);
-		while (iter.hasNext())
-		{
+		while (iter.hasNext()) {
 			final Literal l = (Literal) iter.nextNode();
 			final int i = l.getInt();
 			object[i] = true;
 		}
-		for (int i = 0; i < (num * num); i++)
-		{
-			if ((i % num) == 0)
-			{
+		for (int i = 0; i < (num * num); i++) {
+			if ((i % num) == 0) {
 				Assert.assertTrue(object[i]);
-			}
-			else
-			{
+			} else {
 				Assert.assertFalse(object[i]);
 			}
 		}
@@ -181,50 +153,41 @@ public abstract class AbstractIteratorTe
 	}
 
 	@Test
-	public void testObjectsOfPropertyAndValue()
-	{
+	public void testObjectsOfPropertyAndValue() {
 		NodeIterator iter;
 		final boolean[] object = new boolean[num];
 		final Resource subj = model.createResource();
-		for (int i = 0; i < num; i++)
-		{
+		for (int i = 0; i < num; i++) {
 			model.addLiteral(subj, RDF.value, i);
 			object[i] = false;
 		}
 
 		iter = model.listObjectsOfProperty(subj, RDF.value);
-		while (iter.hasNext())
-		{
+		while (iter.hasNext()) {
 			final int i = ((Literal) iter.nextNode()).getInt();
 			object[i] = true;
 		}
-		for (int i = 0; i < (num); i++)
-		{
+		for (int i = 0; i < (num); i++) {
 			Assert.assertTrue(object[i]);
 		}
 	}
 
 	@Test
-	public void testResourceIterator()
-	{
+	public void testResourceIterator() {
 
 		final boolean subjf[] = new boolean[num];
 
-		for (int i = 0; i < num; i++)
-		{
+		for (int i = 0; i < num; i++) {
 			subjf[i] = false;
 		}
 
 		boolean found = false;
 		final ResIterator rIter = model.listSubjects();
-		while (rIter.hasNext())
-		{
+		while (rIter.hasNext()) {
 			final Resource subj = rIter.nextResource();
 			found = false;
-			for (int i = 0; i < num; i++)
-			{
-				if (subj.equals(subject[i]))
-				{
+			for (int i = 0; i < num; i++) {
+				if (subj.equals(subject[i])) {
 					found = true;
 					Assert.assertFalse("Should not have found " + subject[i]
 							+ " already.", subjf[i]);
@@ -233,8 +196,7 @@ public abstract class AbstractIteratorTe
 			}
 			Assert.assertTrue("Should have found " + subj, found);
 		}
-		for (int i = 0; i < num; i++)
-		{
+		for (int i = 0; i < num; i++) {
 			Assert.assertTrue("Should have found " + subject[i], subjf[i]);
 		}
 
@@ -258,25 +220,20 @@ public abstract class AbstractIteratorTe
 	}
 
 	@Test
-	public void testStatementIter()
-	{
+	public void testStatementIter() {
 		final int numStmts = num * num;
 		final boolean stmtf[] = new boolean[numStmts];
 		Assert.assertEquals(numStmts, model.size());
-		for (int i = 0; i < numStmts; i++)
-		{
+		for (int i = 0; i < numStmts; i++) {
 			stmtf[i] = false;
 		}
 
 		final StmtIterator sIter = model.listStatements();
-		while (sIter.hasNext())
-		{
+		while (sIter.hasNext()) {
 			final Statement stmt = sIter.nextStatement();
 			boolean found = false;
-			for (int i = 0; i < numStmts; i++)
-			{
-				if (stmt.equals(stmts[i]))
-				{
+			for (int i = 0; i < numStmts; i++) {
+				if (stmt.equals(stmts[i])) {
 					found = true;
 					Assert.assertFalse("Should not have found " + stmts[i]
 							+ " already.", stmtf[i]);
@@ -285,8 +242,7 @@ public abstract class AbstractIteratorTe
 			}
 			Assert.assertTrue("Should have found " + stmt, found);
 		}
-		for (int i = 0; i < numStmts; i++)
-		{
+		for (int i = 0; i < numStmts; i++) {
 			Assert.assertTrue("Should have found " + stmts[i], stmtf[i]);
 		}
 	}
@@ -319,5 +275,4 @@ public abstract class AbstractIteratorTe
 	// } */
 	// }
 
-	
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractListObjectsTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractListObjectsTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractListObjectsTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractListObjectsTest.java Wed Oct  9 17:16:15 2013
@@ -26,7 +26,6 @@ import com.hp.hpl.jena.rdf.model.Propert
 import com.hp.hpl.jena.rdf.model.RDFNode;
 import com.hp.hpl.jena.rdf.model.Resource;
 import com.hp.hpl.jena.rdf.model.Statement;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducerUser;
 import com.hp.hpl.jena.vocabulary.RDF;
 
 import java.util.HashSet;
@@ -37,14 +36,13 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public abstract class AbstractListObjectsTest extends AbstractModelProducerUser
-{
+public abstract class AbstractListObjectsTest extends AbstractProducerUser {
 	protected Model model;
 	protected Resource S;
 	protected Property P;
 
 	int num = 5;
-	
+
 	protected static int numObj = 7;
 	protected static int numberSubjects = 7;
 
@@ -53,32 +51,27 @@ public abstract class AbstractListObject
 	protected static final String subjectPrefix = "http://aldabaran/test6/s";
 
 	protected static final String predicatePrefix = "http://aldabaran/test6/";
-	
+
 	Resource subject[] = new Resource[num];
 	Property predicate[] = new Property[num];
 	RDFNode object[] = new RDFNode[numObj];
 
 	@Before
-	final public void setUpAbstractListObjectsTest() throws Exception
-	{
+	final public void setUpAbstractListObjectsTest() throws Exception {
 		model = getModelProducer().newModel();
 		S = model.createResource("http://nowhere.man/subject");
 		P = model.createProperty("http://nowhere.man/predicate");
 	}
 
-	protected Set<Statement> fill( final Model model )
-	{
+	protected Set<Statement> fill(final Model model) {
 		final Set<Statement> statements = new HashSet<Statement>();
-		for (int i = 0; i < AbstractListObjectsTest.numberSubjects; i += 1)
-		{
-			for (int j = 0; j < AbstractListObjectsTest.numberPredicates; j += 1)
-			{
-				final Statement s = model
-						.createLiteralStatement(
-								resource(AbstractListObjectsTest.subjectPrefix + i),
-								property(AbstractListObjectsTest.predicatePrefix
-												+ j + "/p"),
-								(i * AbstractListObjectsTest.numberPredicates) + j);
+		for (int i = 0; i < AbstractListObjectsTest.numberSubjects; i += 1) {
+			for (int j = 0; j < AbstractListObjectsTest.numberPredicates; j += 1) {
+				final Statement s = model.createLiteralStatement(
+						resource(AbstractListObjectsTest.subjectPrefix + i),
+						property(AbstractListObjectsTest.predicatePrefix + j
+								+ "/p"),
+						(i * AbstractListObjectsTest.numberPredicates) + j);
 				model.add(s);
 				statements.add(s);
 			}
@@ -88,11 +81,9 @@ public abstract class AbstractListObject
 		return statements;
 	}
 
-	protected Set<Literal> literalsFor( final int predicate )
-	{
+	protected Set<Literal> literalsFor(final int predicate) {
 		final Set<Literal> result = new HashSet<Literal>();
-		for (int i = 0; i < AbstractListObjectsTest.numberSubjects; i += 1)
-		{
+		for (int i = 0; i < AbstractListObjectsTest.numberSubjects; i += 1) {
 			result.add(model
 					.createTypedLiteral((i * AbstractListObjectsTest.numberPredicates)
 							+ predicate));
@@ -100,41 +91,32 @@ public abstract class AbstractListObject
 		return result;
 	}
 
-	protected Set<Literal> literalsUpto( final int limit )
-	{
+	protected Set<Literal> literalsUpto(final int limit) {
 		final Set<Literal> result = new HashSet<Literal>();
-		for (int i = 0; i < limit; i += 1)
-		{
+		for (int i = 0; i < limit; i += 1) {
 			result.add(model.createTypedLiteral(i));
 		}
 		return result;
 	}
 
-	protected Set<String> predicateSet( final int limit )
-	{
+	protected Set<String> predicateSet(final int limit) {
 		final Set<String> result = new HashSet<String>();
-		for (int i = 0; i < limit; i += 1)
-		{
+		for (int i = 0; i < limit; i += 1) {
 			result.add(AbstractListObjectsTest.predicatePrefix + i + "/");
 		}
 		return result;
 	}
 
-	
-
-	protected Set<Resource> subjectSet( final int limit )
-	{
+	protected Set<Resource> subjectSet(final int limit) {
 		final Set<Resource> result = new HashSet<Resource>();
-		for (int i = 0; i < limit; i += 1)
-		{
+		for (int i = 0; i < limit; i += 1) {
 			result.add(resource(AbstractListObjectsTest.subjectPrefix + i));
 		}
 		return result;
 	}
 
 	@Test
-	public void testListNamespaces()
-	{
+	public void testListNamespaces() {
 		fill(model);
 		final List<String> L = model.listNameSpaces().toList();
 		Assert.assertEquals(AbstractListObjectsTest.numberPredicates, L.size());
@@ -143,42 +125,38 @@ public abstract class AbstractListObject
 	}
 
 	@Test
-	public void testListObjects()
-	{
+	public void testListObjects() {
 		fill(model);
 		final Set<Literal> wanted = literalsUpto(AbstractListObjectsTest.numberSubjects
 				* AbstractListObjectsTest.numberPredicates);
-		Assert.assertEquals(wanted,
-				iteratorToSet(model.listObjects()));
+		Assert.assertEquals(wanted, iteratorToSet(model.listObjects()));
 	}
 
 	@Test
-	public void testListObjectsOfPropertyByProperty()
-	{
+	public void testListObjectsOfPropertyByProperty() {
 		fill(model);
 		final List<RDFNode> L = iteratorToList(model
-				.listObjectsOfProperty(
-						property(AbstractListObjectsTest.predicatePrefix + "0/p")));
+				.listObjectsOfProperty(property(AbstractListObjectsTest.predicatePrefix
+						+ "0/p")));
 		Assert.assertEquals(AbstractListObjectsTest.numberSubjects, L.size());
 		final Set<Literal> wanted = literalsFor(0);
 		Assert.assertEquals(wanted, new HashSet<RDFNode>(L));
 	}
 
 	@Test
-	public void testListObjectsOfPropertyBySubject()
-	{
+	public void testListObjectsOfPropertyBySubject() {
 		final int size = 10;
 		final Resource s = model.createResource();
-		for (int i = 0; i < size; i += 1)
-		{
+		for (int i = 0; i < size; i += 1) {
 			model.addLiteral(s, RDF.value, i);
 		}
-		final List<RDFNode> L = iteratorToList(model
-				.listObjectsOfProperty(s, RDF.value));
+		final List<RDFNode> L = iteratorToList(model.listObjectsOfProperty(s,
+				RDF.value));
 		Assert.assertEquals(size, L.size());
 		final Set<Literal> wanted = literalsUpto(size);
 		Assert.assertEquals(wanted, new HashSet<RDFNode>(L));
 	}
+
 	String suri = "http://aldabaran/test8/s";
 	String puri = "http://aldabaran/test8/";
 
@@ -189,26 +167,19 @@ public abstract class AbstractListObject
 	double tvDoubleArray[] = { 123.456, 456.123 };
 	String tvStringArray[] = { "testing string 1", "testing string 2" };
 	String lang[] = { "en", "fr" };
-	
+
 	@Test
-	public void testListObjectsNoRemove()
-	{
+	public void testListObjectsNoRemove() {
 		final Model m = modelWithStatements(getModelProducer(),
 				"a P b; b Q c; c R a");
 		final NodeIterator it = m.listObjects();
 		it.next();
-		try
-		{
+		try {
 			it.remove();
 			Assert.fail("listObjects should not support .remove()");
-		}
-		catch (final UnsupportedOperationException e)
-		{
+		} catch (final UnsupportedOperationException e) {
 			// expected
 		}
 	}
-	
-	
-	
-	
+
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractLiteralTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractLiteralTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractLiteralTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractLiteralTest.java Wed Oct  9 17:16:15 2013
@@ -25,56 +25,47 @@ import com.hp.hpl.jena.graph.impl.AdhocD
 import com.hp.hpl.jena.rdf.model.Literal;
 import com.hp.hpl.jena.rdf.model.LiteralRequiredException;
 import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducerUser;
 
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
 /**
- * TestLiteralImpl - minimal, this is the first time an extra test has
- * been needed above
- * the regression testing.
+ * TestLiteralImpl - minimal, this is the first time an extra test has been
+ * needed above the regression testing.
  */
-public abstract class AbstractLiteralTest extends AbstractModelProducerUser 
-{
+public abstract class AbstractLiteralTest extends AbstractProducerUser {
 
 	private static Model model;
 	private Resource X;
 	private Property P;
-	
-	static class UniqueValueClass1
-	{
+
+	static class UniqueValueClass1 {
 		String value;
 
-		UniqueValueClass1( final String value )
-		{
+		UniqueValueClass1(final String value) {
 			this.value = value;
 		}
 
 		@Override
-		public String toString()
-		{
+		public String toString() {
 			return value;
 		}
 	}
 
-	static class UniqueValueClass2
-	{
+	static class UniqueValueClass2 {
 		String value;
 
-		UniqueValueClass2( final String value )
-		{
+		UniqueValueClass2(final String value) {
 			this.value = value;
 		}
 
 		@Override
-		public String toString()
-		{
+		public String toString() {
 			return value;
 		}
 	}
-	
+
 	@Before
 	final public void setupAbstractLiteralTest() {
 		model = getModelProducer().newModel();
@@ -86,31 +77,25 @@ public abstract class AbstractLiteralTes
 	 * Test that a literal node can be as'ed into a literal.
 	 */
 	@Test
-	public void testAsLiteral()
-	{
-		literal( "17").as(Literal.class);
+	public void testAsLiteral() {
+		literal("17").as(Literal.class);
 	}
 
 	/**
 	 * Test that a non-literal node cannot be as'ed into a literal
 	 */
 	@Test
-	public void testCannotAsNonLiteral()
-	{
-		try
-		{
+	public void testCannotAsNonLiteral() {
+		try {
 			resource("plumPie").as(Literal.class);
 			Assert.fail("non-literal cannot be converted to literal");
-		}
-		catch (final LiteralRequiredException l)
-		{
+		} catch (final LiteralRequiredException l) {
 			// expected
 		}
 	}
 
 	@Test
-	public void testInModel()
-	{
+	public void testInModel() {
 		final Model m2 = getModelProducer().newModel();
 		final Literal l1 = model.createLiteral("17");
 		final Literal l2 = l1.inModel(m2);
@@ -119,8 +104,7 @@ public abstract class AbstractLiteralTes
 	}
 
 	@Test
-	public void testLiteralHasModel()
-	{
+	public void testLiteralHasModel() {
 		testLiteralHasModel(model, model.createLiteral("hello, world"));
 		testLiteralHasModel(model, model.createLiteral("hello, world", "en-UK"));
 		testLiteralHasModel(model, model.createLiteral("hello, world", true));
@@ -130,16 +114,13 @@ public abstract class AbstractLiteralTes
 		testLiteralHasModel(model, model.createTypedLiteral('x'));
 	}
 
-	private void testLiteralHasModel( final Model m, final Literal lit )
-	{
+	private void testLiteralHasModel(final Model m, final Literal lit) {
 		Assert.assertSame(m, lit.getModel());
 	}
 
 	@Test
-	public void testSameAdhocClassUS()
-	{
-		try
-		{
+	public void testSameAdhocClassUS() {
+		try {
 			final UniqueValueClass1 ra = new UniqueValueClass1("rhubarb");
 			final UniqueValueClass1 rb = new UniqueValueClass1("cottage");
 			Assert.assertNull("not expecting registered RDF Datatype",
@@ -153,17 +134,14 @@ public abstract class AbstractLiteralTes
 			assertInstanceOf(AdhocDatatype.class, la.getDatatype());
 			Assert.assertSame(la.getDatatype(), lb.getDatatype());
 			Assert.assertNotNull(TypeMapper.getInstance().getTypeByValue(ra));
-		}
-		finally
-		{
+		} finally {
 			TypeMapper.reset();
 		}
 	}
 
 	// Tests are not necessarily run in order so use UniqueValueClass2
 	@Test
-	public void testTypedLiteralTypesAndValues()
-	{
+	public void testTypedLiteralTypesAndValues() {
 		// Resource r = model.createResource( "eh:/rhubarb" );
 		final UniqueValueClass2 r = new UniqueValueClass2("rhubarb");
 		Assert.assertNull("not expecting registered RDF Datatype", TypeMapper
@@ -176,8 +154,7 @@ public abstract class AbstractLiteralTes
 		final Literal string = model.createLiteral(r.value);
 		Assert.assertEquals(string.getLexicalForm(), typed.getLexicalForm());
 		Assert.assertEquals(string.getLanguage(), typed.getLanguage());
-		assertDiffer(string.getDatatypeURI(),
-				typed.getDatatypeURI());
+		assertDiffer(string.getDatatypeURI(), typed.getDatatypeURI());
 		Assert.assertNotNull(
 				"a datatype should have been invented for Resource[Impl]",
 				typed.getDatatype());
@@ -187,36 +164,28 @@ public abstract class AbstractLiteralTes
 		assertDiffer(typed.hashCode(), string.hashCode());
 	}
 
-	protected void assertInRange( final long min, final long x, final long max )
-	{
-		if ((min <= x) && (x <= max))
-		{
+	protected void assertInRange(final long min, final long x, final long max) {
+		if ((min <= x) && (x <= max)) {
 			return;
-		}
-		else
-		{
+		} else {
 			Assert.fail("outside range: " + x + " min: " + min + " max: " + max);
 		}
 	}
 
-	protected void assertOutsideRange( final long min, final long x,
-			final long max )
-	{
-		if ((min <= x) && (x <= max))
-		{
+	protected void assertOutsideRange(final long min, final long x,
+			final long max) {
+		if ((min <= x) && (x <= max)) {
 			Assert.fail("inside range: " + x + " min: " + min + " max: " + max);
 		}
 	}
 
 	@Test
-	public void testBooleans()
-	{
+	public void testBooleans() {
 		Assert.assertTrue(model.createTypedLiteral(true).getBoolean());
 		Assert.assertFalse(model.createTypedLiteral(false).getBoolean());
 	}
 
-	protected void testByte( final Model model, final byte tv )
-	{
+	protected void testByte(final Model model, final byte tv) {
 		final Literal l = model.createTypedLiteral(tv);
 		Assert.assertEquals(tv, l.getByte());
 		Assert.assertEquals(tv, l.getShort());
@@ -225,22 +194,19 @@ public abstract class AbstractLiteralTes
 	}
 
 	@Test
-	public void testByteLiterals()
-	{
+	public void testByteLiterals() {
 		testByte(model, (byte) 0);
 		testByte(model, (byte) -1);
 		testByte(model, Byte.MIN_VALUE);
 		testByte(model, Byte.MAX_VALUE);
 	}
 
-	protected void testCharacter( final Model model, final char tv )
-	{
+	protected void testCharacter(final Model model, final char tv) {
 		Assert.assertEquals(tv, model.createTypedLiteral(tv).getChar());
 	}
 
 	@Test
-	public void testCharacterLiterals()
-	{
+	public void testCharacterLiterals() {
 		testCharacter(model, 'A');
 		testCharacter(model, 'a');
 		testCharacter(model, '#');
@@ -251,15 +217,13 @@ public abstract class AbstractLiteralTes
 		testCharacter(model, '\u5678');
 	}
 
-	protected void testDouble( final Model model, final double tv )
-	{
+	protected void testDouble(final Model model, final double tv) {
 		Assert.assertEquals(tv, model.createTypedLiteral(tv).getDouble(),
 				dDelta);
 	}
 
 	@Test
-	public void testDoubleLiterals()
-	{
+	public void testDoubleLiterals() {
 		testDouble(model, 0.0);
 		testDouble(model, 1.0);
 		testDouble(model, -1.0);
@@ -268,15 +232,12 @@ public abstract class AbstractLiteralTes
 		testDouble(model, Double.MAX_VALUE);
 	}
 
-	protected void testFloat( final Model model, final float tv )
-	{
-		Assert.assertEquals(tv, model.createTypedLiteral(tv).getFloat(),
-				fDelta);
+	protected void testFloat(final Model model, final float tv) {
+		Assert.assertEquals(tv, model.createTypedLiteral(tv).getFloat(), fDelta);
 	}
 
 	@Test
-	public void testFloatLiterals()
-	{
+	public void testFloatLiterals() {
 		testFloat(model, 0.0f);
 		testFloat(model, 1.0f);
 		testFloat(model, -1.0f);
@@ -292,33 +253,22 @@ public abstract class AbstractLiteralTes
 	// // testLiteralObject( model, -67890 );
 	// }
 
-	protected void testInt( final Model model, final int tv )
-	{
+	protected void testInt(final Model model, final int tv) {
 		final Literal l = model.createTypedLiteral(tv);
-		try
-		{
+		try {
 			Assert.assertEquals(tv, l.getByte());
 			assertInRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
-		}
-		catch (final NumberFormatException e)
-		{
+		} catch (final NumberFormatException e) {
 			assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
-		}
-		catch (final IllegalArgumentException e)
-		{
+		} catch (final IllegalArgumentException e) {
 			assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
 		}
-		try
-		{
+		try {
 			Assert.assertEquals(tv, l.getShort());
 			assertInRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
-		}
-		catch (final NumberFormatException e)
-		{
+		} catch (final NumberFormatException e) {
 			assertOutsideRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
-		}
-		catch (final IllegalArgumentException e)
-		{
+		} catch (final IllegalArgumentException e) {
 			assertOutsideRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
 		}
 		Assert.assertEquals(tv, l.getInt());
@@ -326,17 +276,15 @@ public abstract class AbstractLiteralTes
 	}
 
 	@Test
-	public void testIntLiterals()
-	{
+	public void testIntLiterals() {
 		testInt(model, 0);
 		testInt(model, -1);
 		testInt(model, Integer.MIN_VALUE);
 		testInt(model, Integer.MAX_VALUE);
 	}
 
-	protected void testLanguagedString( final Model model, final String tv,
-			final String lang )
-	{
+	protected void testLanguagedString(final Model model, final String tv,
+			final String lang) {
 		final Literal l = model.createLiteral(tv, lang);
 		Assert.assertEquals(tv, l.getString());
 		Assert.assertEquals(tv, l.getLexicalForm());
@@ -344,68 +292,49 @@ public abstract class AbstractLiteralTes
 	}
 
 	@Test
-	public void testLanguagedStringLiterals()
-	{
+	public void testLanguagedStringLiterals() {
 		testLanguagedString(model, "", "en");
 		testLanguagedString(model, "chat", "fr");
 	}
 
-	protected void testLong( final Model model, final long tv )
-	{
+	protected void testLong(final Model model, final long tv) {
 		final Literal l = model.createTypedLiteral(tv);
-		try
-		{
+		try {
 			Assert.assertEquals(tv, l.getByte());
 			assertInRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
-		}
-		catch (final NumberFormatException e)
-		{
+		} catch (final NumberFormatException e) {
 			assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
-		}
-		catch (final IllegalArgumentException e)
-		{
+		} catch (final IllegalArgumentException e) {
 			assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
 		}
-		try
-		{
+		try {
 			Assert.assertEquals(tv, l.getShort());
 			assertInRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
-		}
-		catch (final NumberFormatException e)
-		{
+		} catch (final NumberFormatException e) {
 			assertOutsideRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
-		}
-		catch (final IllegalArgumentException e)
-		{
+		} catch (final IllegalArgumentException e) {
 			assertOutsideRange(Short.MIN_VALUE, tv, Short.MAX_VALUE);
 		}
-		try
-		{
+		try {
 			Assert.assertEquals(tv, l.getInt());
 			assertInRange(Integer.MIN_VALUE, tv, Integer.MAX_VALUE);
-		}
-		catch (final NumberFormatException e)
-		{
+		} catch (final NumberFormatException e) {
 			assertOutsideRange(Integer.MIN_VALUE, tv, Integer.MAX_VALUE);
-		}
-		catch (final IllegalArgumentException e)
-		{
+		} catch (final IllegalArgumentException e) {
 			assertOutsideRange(Integer.MIN_VALUE, tv, Integer.MAX_VALUE);
 		}
 		Assert.assertEquals(tv, l.getLong());
 	}
 
 	@Test
-	public void testLongLiterals()
-	{
+	public void testLongLiterals() {
 		testLong(model, 0);
 		testLong(model, -1);
 		testLong(model, Long.MIN_VALUE);
 		testLong(model, Long.MAX_VALUE);
 	}
 
-	protected void testPlainString( final Model model, final String tv )
-	{
+	protected void testPlainString(final Model model, final String tv) {
 		final Literal l = model.createLiteral(tv);
 		Assert.assertEquals(tv, l.getString());
 		Assert.assertEquals(tv, l.getLexicalForm());
@@ -413,27 +342,20 @@ public abstract class AbstractLiteralTes
 	}
 
 	@Test
-	public void testPlainStringLiterals()
-	{
+	public void testPlainStringLiterals() {
 		testPlainString(model, "");
 		testPlainString(model, "A test string");
 		testPlainString(model, "Another test string");
 	}
 
-	protected void testShort( final Model model, final short tv )
-	{
+	protected void testShort(final Model model, final short tv) {
 		final Literal l = model.createTypedLiteral(tv);
-		try
-		{
+		try {
 			Assert.assertEquals(tv, l.getByte());
 			assertInRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
-		}
-		catch (final NumberFormatException e)
-		{
+		} catch (final NumberFormatException e) {
 			assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
-		}
-		catch (final IllegalArgumentException e)
-		{
+		} catch (final IllegalArgumentException e) {
 			assertOutsideRange(Byte.MIN_VALUE, tv, Byte.MAX_VALUE);
 		}
 		Assert.assertEquals(tv, l.getShort());
@@ -442,8 +364,7 @@ public abstract class AbstractLiteralTes
 	}
 
 	@Test
-	public void testShortLiterals()
-	{
+	public void testShortLiterals() {
 		testShort(model, (short) 0);
 		testShort(model, (short) -1);
 		testShort(model, Short.MIN_VALUE);
@@ -451,17 +372,13 @@ public abstract class AbstractLiteralTes
 	}
 
 	@Test
-	public void testStringLiteralEquality()
-	{
+	public void testStringLiteralEquality() {
 		Assert.assertEquals(model.createLiteral("A"), model.createLiteral("A"));
 		Assert.assertEquals(model.createLiteral("Alpha"),
 				model.createLiteral("Alpha"));
-		assertDiffer(model.createLiteral("Alpha"),
-				model.createLiteral("Beta"));
-		assertDiffer(model.createLiteral("A", "en"),
-				model.createLiteral("A"));
-		assertDiffer(model.createLiteral("A"),
-				model.createLiteral("A", "en"));
+		assertDiffer(model.createLiteral("Alpha"), model.createLiteral("Beta"));
+		assertDiffer(model.createLiteral("A", "en"), model.createLiteral("A"));
+		assertDiffer(model.createLiteral("A"), model.createLiteral("A", "en"));
 		assertDiffer(model.createLiteral("A", "en"),
 				model.createLiteral("A", "fr"));
 		Assert.assertEquals(model.createLiteral("A", "en"),
@@ -474,50 +391,44 @@ public abstract class AbstractLiteralTes
 	// LitTestObjF factory = new LitTestObjF();
 	// assertEquals( tv, model.createTypedLiteral( tv ).getObject( factory ) );
 	// }
-	
+
 	@Test
-	public void testAddWithBooleanObject()
-	{
+	public void testAddWithBooleanObject() {
 		model.addLiteral(X, P, true);
 		Assert.assertTrue(model.contains(X, P, model.createTypedLiteral(true)));
 		Assert.assertTrue(model.containsLiteral(X, P, true));
 	}
 
 	@Test
-	public void testAddWithCharObject()
-	{
+	public void testAddWithCharObject() {
 		model.addLiteral(X, P, 'x');
 		Assert.assertTrue(model.contains(X, P, model.createTypedLiteral('x')));
 		Assert.assertTrue(model.containsLiteral(X, P, 'x'));
 	}
 
 	@Test
-	public void testAddWithDoubleObject()
-	{
+	public void testAddWithDoubleObject() {
 		model.addLiteral(X, P, 14.0d);
 		Assert.assertTrue(model.contains(X, P, model.createTypedLiteral(14.0d)));
 		Assert.assertTrue(model.containsLiteral(X, P, 14.0d));
 	}
 
 	@Test
-	public void testAddWithFloatObject()
-	{
+	public void testAddWithFloatObject() {
 		model.addLiteral(X, P, 14.0f);
 		Assert.assertTrue(model.contains(X, P, model.createTypedLiteral(14.0f)));
 		Assert.assertTrue(model.containsLiteral(X, P, 14.0f));
 	}
 
 	@Test
-	public void testAddWithIntObject()
-	{
+	public void testAddWithIntObject() {
 		model.addLiteral(X, P, 99);
 		Assert.assertTrue(model.contains(X, P, model.createTypedLiteral(99)));
 		Assert.assertTrue(model.containsLiteral(X, P, 99));
 	}
 
 	@Test
-	public void testAddWithLiteralObject()
-	{
+	public void testAddWithLiteralObject() {
 		final Literal lit = model.createLiteral("spoo");
 		model.addLiteral(X, P, lit);
 		Assert.assertTrue(model.contains(X, P, lit));
@@ -525,8 +436,7 @@ public abstract class AbstractLiteralTes
 	}
 
 	@Test
-	public void testAddWithLongObject()
-	{
+	public void testAddWithLongObject() {
 		model.addLiteral(X, P, 99L);
 		Assert.assertTrue(model.contains(X, P, model.createTypedLiteral(99L)));
 		Assert.assertTrue(model.containsLiteral(X, P, 99L));

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractSuite.java Wed Oct  9 17:16:15 2013
@@ -1,219 +1,349 @@
 package com.hp.hpl.jena.rdf.model;
 
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runners.Suite;
+import java.util.StringTokenizer;
 
-import com.hp.hpl.jena.shared.AbstractPrefixMappingTest;
-import com.hp.hpl.jena.shared.PrefixMapping;
-import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
-import com.hp.hpl.jena.testing_framework.NodeProducerInterface;
-
-@Suite.SuiteClasses({AbstractModelContractSuite.ModelContractTests.class,
-	AbstractModelContractSuite.LockContractTests.class,
-	AbstractModelContractSuite.ModelConContractTests.class,
-	AbstractModelContractSuite.ModelGraphInterfaceContractTests.class,
-	AbstractModelContractSuite.PrefixMappingContractTests.class,
-	AbstractModelContractSuite.RDFReaderFContractTests.class,
-	AbstractModelContractSuite.RDFWriterFContractTests.class,
-	AbstractModelContractSuite.AltMethodsTests.class,
-	AbstractModelContractSuite.BagMethodsTests.class,
-	AbstractModelContractSuite.SeqMethodsTests.class,
-	AbstractModelContractSuite.RDFNodeTests.class,
-	AbstractModelContractSuite.ResourceTests.class,
-	AbstractModelContractSuite.StatementTests.class,
-	})
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractImpl;
+import org.xenei.junit.contract.ContractSuite;
+import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
+import com.hp.hpl.jena.testing_framework.IContainerProducer;
+import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
+import com.hp.hpl.jena.testing_framework.INodeProducer;
+import com.hp.hpl.jena.testing_framework.IStatementProducer;
+import com.hp.hpl.jena.vocabulary.RDF;
+
+@Suite.SuiteClasses({ AbstractModelContractSuite.ModelContractTests.class,
+		AbstractModelContractSuite.AltMethodsTests.class,
+		AbstractModelContractSuite.BagMethodsTests.class,
+		AbstractModelContractSuite.SeqMethodsTests.class,
+		// AbstractModelContractSuite.RDFNodeTests.class,
+		AbstractModelContractSuite.ResourceTests.class,
+		AbstractModelContractSuite.StatementTests.class, })
+// @RunWith( ContractSuite.class )
 public abstract class AbstractModelContractSuite {
-	static protected ModelProducerInterface modelProducer;
-	
-	public static void setModelProducer(ModelProducerInterface modelProducer) {
+
+	static protected AbstractModelProducer<Model> modelProducer;
+
+	public static void setModelProducer(
+			AbstractModelProducer<Model> modelProducer) {
 		AbstractModelContractSuite.modelProducer = modelProducer;
 	}
-	
-	public static class ModelContractTests extends AbstractModelContractTests {
 
-		@Override
-		public ModelProducerInterface getModelProducer() {
+	// static protected NodeProducerInterface nodeProducer = new
+	// NodeProducerInterface()
+	// {
+	//
+	// @Override
+	// public RDFNode newRDFNode() {
+	// return modelProducer.newModel().createResource();
+	// }
+	// };
+
+	@RunWith(ContractSuite.class)
+	@ContractImpl(Model.class)
+	public static class ModelContractTests {
+
+		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+		public AbstractModelProducer<Model> getModelProducer() {
 			return modelProducer;
 		}
 
-		@Override
-		@Test
-		public void testIndependent() {
-			// TODO Auto-generated method stub
-			
-		}
-		
 	}
-	
-	public static class ModelConContractTests extends AbstractModelConContractTests {
 
-		@Override
-		public ModelProducerInterface getModelProducer() {
-			return modelProducer;
-		}
-		
-	}
+	// public static class ModelGraphInterfaceContractTests extends
+	// AbstractModelGraphInterfaceContractTests {
+	//
+	// ModelGraphInterface modelGraphInterface = null;
+	//
+	// @Override
+	// protected ModelGraphInterface getModelGraphInterface() {
+	// if (modelGraphInterface == null)
+	// {
+	// modelGraphInterface = modelProducer.newModel();
+	// }
+	// return modelGraphInterface;
+	// }
+	//
+	// @After
+	// public final void afterModelGraphInterfaceContractTests() {
+	// modelGraphInterface = null;
+	// modelProducer.closeModels();
+	// }
+	//
+	//
+	// }
+	//
+	// public static class PrefixMappingContractTests extends
+	// AbstractPrefixMappingTest {
+	//
+	// @Override
+	// protected PrefixMapping getMapping() {
+	// return modelProducer.newModel();
+	// }
+	//
+	// @After
+	// public final void afterPrefixMappingContractTests() {
+	//
+	// modelProducer.closeModels();
+	// }
+	//
+	// }
+	//
+	public interface A extends Alt {
+	}
+
+	@RunWith(ContractSuite.class)
+	@ContractImpl(A.class)
+	public static class AltMethodsTests {
 
-	public static class RDFReaderFContractTests extends AbstractRDFReaderFContractTests {
+		private IContainerProducer<Alt> producer = new IContainerProducer<Alt>() {
+			private Model model = null;
 
-		private RDFReaderF reader = null;
-			
-		@Override
-		protected RDFReaderF getRDFReaderF() {
-			if (reader == null)
-			{
-				reader = modelProducer.newModel();
+			@Override
+			public Alt newInstance() {
+				return getModel().createAlt();
 			}
-			return reader;
-		}
-		
-		@After
-		public final void afterRDFReaderFContractTests()
-		{
-			modelProducer.closeModels();
-			reader = null;
-		}
-	
-	}
-	
-	public static class RDFWriterFContractTests extends AbstractRDFWriterFContractTests {
 
-		private RDFWriterF writer = null;
-			
-		@Override
-		protected RDFWriterF getRDFWriterF() {
-			if (writer == null)
-			{
-				writer = modelProducer.newModel();
+			@Override
+			public void cleanUp() {
+				modelProducer.cleanUp();
+				model = null;
 			}
-			return writer;
-		}
-		
-		@After
-		public final void afterRDFReaderFContractTests()
-		{
-			modelProducer.closeModels();
-			writer = null;
-		}
-	
-	}
-	
-	public static class LockContractTests extends AbstractLockContractTests {
 
-		@Override
-		public ModelProducerInterface getModelProducer() {
-			return modelProducer;
-		}
-		
-	}
-	
-	public static class ModelGraphInterfaceContractTests extends AbstractModelGraphInterfaceContractTests {
+			@Override
+			public Alt newInstance(String uri) {
+				return getModel().createAlt(uri);
+			}
 
-		ModelGraphInterface modelGraphInterface = null;
-		
-		@Override
-		protected ModelGraphInterface getModelGraphInterface() {
-			if (modelGraphInterface == null)
-			{
-				modelGraphInterface = modelProducer.newModel();
+			@Override
+			public Model getModel() {
+				if (model == null) {
+					model = modelProducer.newInstance();
+				}
+				return model;
 			}
-			return modelGraphInterface;
-		}
-		
-		@After
-		public final void afterModelGraphInterfaceContractTests() {
-			modelGraphInterface = null;
-			modelProducer.closeModels();
-		}
 
-		
-	}
-	
-	public static class PrefixMappingContractTests extends AbstractPrefixMappingTest {
-		
-		@Override
-		protected PrefixMapping getMapping() {
-			return modelProducer.newModel();
-		}
+			@Override
+			public Resource getContainerType() {
+				return RDF.Alt;
+			}
 
-		@After
-		public final void afterPrefixMappingContractTests() {
+			@Override
+			public Class<? extends Container> getContainerClass() {
+				return Alt.class;
+			}
+		};
 
-			modelProducer.closeModels();
+		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+		public IContainerProducer<Alt> getAltProducer() {
+			return producer;
 		}
-	
+
 	}
-	
-	public static class AltMethodsTests extends AbstractAltMethodsTest {
 
-		@Override
-		public ModelProducerInterface getModelProducer() {
-			return modelProducer;
-		}
-		
+	public interface B extends Bag {
 	}
-	
-	public static class BagMethodsTests extends AbstractBagMethodsTest {
 
-		@Override
-		public ModelProducerInterface getModelProducer() {
-			return modelProducer;
+	@RunWith(ContractSuite.class)
+	@ContractImpl(B.class)
+	public static class BagMethodsTests {
+
+		private IContainerProducer<Bag> producer = new IContainerProducer<Bag>() {
+			private Model model = null;
+
+			@Override
+			public Bag newInstance() {
+				return getModel().createBag();
+			}
+
+			@Override
+			public void cleanUp() {
+				modelProducer.cleanUp();
+				model = null;
+			}
+
+			@Override
+			public Bag newInstance(String uri) {
+				return getModel().createBag(uri);
+			}
+
+			@Override
+			public Model getModel() {
+				if (model == null) {
+					model = modelProducer.newInstance();
+				}
+				return model;
+			}
+
+			@Override
+			public Resource getContainerType() {
+				return RDF.Bag;
+			}
+
+			@Override
+			public Class<? extends Container> getContainerClass() {
+				return Bag.class;
+			}
+		};
+
+		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+		public IContainerProducer<Bag> getBagProducer() {
+			return producer;
 		}
-		
 	}
-	
-	public static class SeqMethodsTests extends AbstractSeqMethodsTest {
 
-		@Override
-		public ModelProducerInterface getModelProducer() {
-			return modelProducer;
-		}
-		
+	public interface S extends Seq {
 	}
-	
-	public static class RDFNodeTests extends AbstractRDFNodeContractTests {
 
-		NodeProducerInterface producer = new NodeProducerInterface()
-		{
+	@RunWith(ContractSuite.class)
+	@ContractImpl(S.class)
+	public static class SeqMethodsTests {
+		private IContainerProducer<Seq> producer = new IContainerProducer<Seq>() {
+			private Model model = null;
+
+			@Override
+			public Seq newInstance() {
+				return getModel().createSeq();
+			}
+
+			@Override
+			public void cleanUp() {
+				modelProducer.cleanUp();
+				model = null;
+			}
+
+			@Override
+			public Seq newInstance(String uri) {
+				return getModel().createSeq(uri);
+			}
+
+			@Override
+			public Model getModel() {
+				if (model == null) {
+					model = modelProducer.newInstance();
+				}
+				return model;
+			}
 
 			@Override
-			public RDFNode newRDFNode() {
-				return modelProducer.newModel().createResource();
-			}	
+			public Resource getContainerType() {
+				return RDF.Seq;
+			}
+
+			@Override
+			public Class<? extends Container> getContainerClass() {
+				return Seq.class;
+			}
 		};
 
-		@Override
-		protected NodeProducerInterface getNodeProducer() {
+		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+		public IContainerProducer<Seq> getSeqProducer() {
 			return producer;
 		}
-		
+
 	}
-	
-	public static class ResourceTests extends AbstractResourceTest {
 
-		NodeProducerInterface producer = new NodeProducerInterface()
-		{
+	//
+	// public static class RDFNodeTests extends RDFNodeContractTests {
+	//
+	// @Override
+	// protected NodeProducerInterface getNodeProducer() {
+	// return nodeProducer;
+	// }
+	//
+	// }
+	//
+	public interface R extends Resource {
+	}
+
+	@RunWith(ContractSuite.class)
+	@ContractImpl(R.class)
+	public static class ResourceTests {
+		private INodeProducer<Resource> producer = new INodeProducer<Resource>() {
+			private Model model;
+
+			@Override
+			public Resource newInstance() {
+				return getModel().createResource();
+			}
+
+			@Override
+			public void cleanUp() {
+				modelProducer.cleanUp();
+				model = null;
+			}
+
+			@Override
+			public Resource newInstance(String uri) {
+				return getModel().createResource(uri);
+			}
 
 			@Override
-			public RDFNode newRDFNode() {
-				return modelProducer.newModel().createResource();
-			}	
+			public Model getModel() {
+				if (model == null) {
+					model = modelProducer.newInstance();
+				}
+				return model;
+			}
 		};
 
-		@Override
-		protected NodeProducerInterface getNodeProducer() {
+		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+		public INodeProducer<Resource> getNodeProducer() {
 			return producer;
 		}
+
 	}
-	
-	public static class StatementTests extends AbstractStatementTest {
 
-		@Override
-		public ModelProducerInterface getModelProducer() {
-			return modelProducer;
+	public interface Stmt extends Statement {
+	}
+
+	@RunWith(ContractSuite.class)
+	@ContractImpl(Stmt.class)
+	public static class StatementTests {
+		private IStatementProducer<Statement> producer = new IStatementProducer<Statement>() {
+
+			private Model model;
+
+			@Override
+			public Statement newInstance(String fact) {
+				StringTokenizer st = new StringTokenizer(fact);
+				Resource sub = resource(st.nextToken());
+				Property pred = property(st.nextToken());
+				RDFNode obj = rdfNode(st.nextToken());
+				return newInstance(sub, pred, obj);
+			}
+
+			@Override
+			public Statement newInstance(Resource s, Property p, RDFNode o) {
+				return getModel().createStatement(s, p, o);
+			}
+
+			@Override
+			public Model getModel() {
+				if (model == null) {
+					model = getModelProducer().newInstance();
+				}
+				return model;
+			}
+
+			@Override
+			public void cleanUp() {
+				getModelProducer().cleanUp();
+				model = null;
+			}
+
+			@Override
+			public AbstractModelProducer<Model> getModelProducer() {
+				return modelProducer;
+			}
+		};
+
+		@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+		public IStatementProducer<Statement> getStatementProducer() {
+			return producer;
 		}
-		
+
 	}
 }
-

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelExtractTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelExtractTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelExtractTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelExtractTest.java Wed Oct  9 17:16:15 2013
@@ -31,33 +31,26 @@ import com.hp.hpl.jena.rdf.model.Stateme
 import com.hp.hpl.jena.rdf.model.StatementBoundary;
 import com.hp.hpl.jena.rdf.model.StatementBoundaryBase;
 import com.hp.hpl.jena.rdf.model.StatementTripleBoundary;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducerUser;
-
 import org.junit.Assert;
 import org.junit.Test;
 
-public abstract class AbstractModelExtractTest extends AbstractModelProducerUser
-{
-	
-	static class MockModelExtract extends ModelExtract
-	{
+public abstract class AbstractModelExtractTest extends AbstractProducerUser {
+
+	static class MockModelExtract extends ModelExtract {
 		Node root;
 		Graph result;
 		Graph subject;
 
-		public MockModelExtract( final StatementBoundary b )
-		{
+		public MockModelExtract(final StatementBoundary b) {
 			super(b);
 		}
 
 		@Override
-		protected GraphExtract getGraphExtract( final TripleBoundary b )
-		{
+		protected GraphExtract getGraphExtract(final TripleBoundary b) {
 			return new GraphExtract(b) {
 				@Override
-				public Graph extractInto( final Graph toUpdate, final Node n,
-						final Graph source )
-				{
+				public Graph extractInto(final Graph toUpdate, final Node n,
+						final Graph source) {
 					root = n;
 					return result = super.extractInto(toUpdate, n,
 							subject = source);
@@ -65,41 +58,36 @@ public abstract class AbstractModelExtra
 			};
 		}
 
-		public StatementBoundary getStatementBoundary()
-		{
+		public StatementBoundary getStatementBoundary() {
 			return boundary;
 		}
 	}
 
 	protected static final StatementBoundary sbTrue = new StatementBoundaryBase() {
 		@Override
-		public boolean stopAt( final Statement s )
-		{
+		public boolean stopAt(final Statement s) {
 			return true;
 		}
 	};
 
 	protected static final StatementBoundary sbFalse = new StatementBoundaryBase() {
 		@Override
-		public boolean stopAt( final Statement s )
-		{
+		public boolean stopAt(final Statement s) {
 			return false;
 		}
 	};
 
 	@Test
-	public void testAsTripleBoundary()
-	{
+	public void testAsTripleBoundary() {
 		final Model m = ModelFactory.createDefaultModel();
-		Assert.assertTrue(AbstractModelExtractTest.sbTrue.asTripleBoundary(m).stopAt(
-				triple("x R y")));
-		Assert.assertFalse(AbstractModelExtractTest.sbFalse.asTripleBoundary(m).stopAt(
-				triple("x R y")));
+		Assert.assertTrue(AbstractModelExtractTest.sbTrue.asTripleBoundary(m)
+				.stopAt(triple("x R y")));
+		Assert.assertFalse(AbstractModelExtractTest.sbFalse.asTripleBoundary(m)
+				.stopAt(triple("x R y")));
 	}
 
 	@Test
-	public void testInvokesExtract()
-	{
+	public void testInvokesExtract() {
 		final MockModelExtract mock = new MockModelExtract(
 				AbstractModelExtractTest.sbTrue);
 		final Model source = modelWithStatements(getModelProducer(), "a R b");
@@ -110,21 +98,20 @@ public abstract class AbstractModelExtra
 	}
 
 	@Test
-	public void testRemembersBoundary()
-	{
-		Assert.assertSame(AbstractModelExtractTest.sbTrue, new MockModelExtract(
-				AbstractModelExtractTest.sbTrue).getStatementBoundary());
-		Assert.assertSame(AbstractModelExtractTest.sbFalse, new MockModelExtract(
-				AbstractModelExtractTest.sbFalse).getStatementBoundary());
+	public void testRemembersBoundary() {
+		Assert.assertSame(AbstractModelExtractTest.sbTrue,
+				new MockModelExtract(AbstractModelExtractTest.sbTrue)
+						.getStatementBoundary());
+		Assert.assertSame(AbstractModelExtractTest.sbFalse,
+				new MockModelExtract(AbstractModelExtractTest.sbFalse)
+						.getStatementBoundary());
 	}
 
 	@Test
-	public void testStatementContinueWith()
-	{
+	public void testStatementContinueWith() {
 		final StatementBoundary sb = new StatementBoundaryBase() {
 			@Override
-			public boolean continueWith( final Statement s )
-			{
+			public boolean continueWith(final Statement s) {
 				return false;
 			}
 		};
@@ -132,18 +119,18 @@ public abstract class AbstractModelExtra
 	}
 
 	@Test
-	public void testStatementTripleBoundaryAnon()
-	{
+	public void testStatementTripleBoundaryAnon() {
 		final TripleBoundary anon = TripleBoundary.stopAtAnonObject;
 		Assert.assertSame(anon,
 				new StatementTripleBoundary(anon).asTripleBoundary(null));
-		Assert.assertFalse(new StatementTripleBoundary(anon).stopAt(statement("s P o")));
-		Assert.assertTrue(new StatementTripleBoundary(anon).stopAt(statement("s P _o")));
+		Assert.assertFalse(new StatementTripleBoundary(anon)
+				.stopAt(statement("s P o")));
+		Assert.assertTrue(new StatementTripleBoundary(anon)
+				.stopAt(statement("s P _o")));
 	}
 
 	@Test
-	public void testStatementTripleBoundaryNowhere()
-	{
+	public void testStatementTripleBoundaryNowhere() {
 		final TripleBoundary nowhere = TripleBoundary.stopNowhere;
 		Assert.assertSame(nowhere,
 				new StatementTripleBoundary(nowhere).asTripleBoundary(null));
@@ -153,5 +140,4 @@ public abstract class AbstractModelExtra
 				.stopAt(statement("s P o")));
 	}
 
-	
 }



Mime
View raw message