jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cla...@apache.org
Subject svn commit: r1530718 [7/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
Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java (from r1525342, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractTests.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractTests.java&r1=1525342&r2=1530718&rev=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractModelContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java Wed Oct  9 17:16:15 2013
@@ -18,7 +18,6 @@
 
 package com.hp.hpl.jena.rdf.model;
 
-import static com.hp.hpl.jena.testing_framework.GraphHelper.iteratorToSet;
 import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
 import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
@@ -32,11 +31,8 @@ import java.io.Reader;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
-
 import javax.xml.XMLConstants;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.parsers.DocumentBuilder;
@@ -45,18 +41,20 @@ import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFactory;
 
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
+import org.xenei.junit.contract.Contract;
 import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
 import com.hp.hpl.jena.graph.GraphEvents;
 import com.hp.hpl.jena.rdf.model.impl.StmtIteratorImpl;
 import com.hp.hpl.jena.shared.Command;
 import com.hp.hpl.jena.shared.PropertyNotFoundException;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducerUser;
+import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
 import com.hp.hpl.jena.testing_framework.ModelHelper.LitTestObj;
 import com.hp.hpl.jena.testing_framework.TestFileData;
 import com.hp.hpl.jena.vocabulary.RDF;
@@ -69,21 +67,31 @@ import com.hp.hpl.jena.vocabulary.RDFS;
  * independent or not.
  * 
  */
-public abstract class AbstractModelContractTests extends AbstractModelProducerUser {
+@Contract(Model.class)
+public abstract class ModelContractTests {
 	private Model model;
 	private RecordingModelListener SL;
 
-	private static Logger log = LoggerFactory
-			.getLogger(AbstractModelContractTests.class);
+	private static Logger LOG = LoggerFactory
+			.getLogger(ModelContractTests.class);
+
+	@Contract.Inject("com.hp.hpl.jena.testing_framework.AbstractModelProducer<%s>")
+	abstract public AbstractModelProducer<Model> getProducer();
 
 	@Before
-	final public void setupAbstractModelTest() {
-		model = getModelProducer().newModel();
+	final public void beforeModelContractTests() {
+		model = getProducer().newInstance();
+		SL = new RecordingModelListener();
+	}
+
+	@After
+	final public void afterModelContractTest() {
+		model = getProducer().newInstance();
 		SL = new RecordingModelListener();
 	}
 
 	/*
-	 * MODEL INTERFACE TESTS 
+	 * MODEL INTERFACE TESTS
 	 */
 
 	/**
@@ -781,24 +789,28 @@ public abstract class AbstractModelContr
 		} catch (final NullPointerException expected) { // expected}
 		}
 
-		Literal lit = model.createLiteral( "13" , true );
-		//"13^^http://www.w3.org/2001/XMLSchema#integer", true);
+		Literal lit = model.createLiteral("13", true);
+		// "13^^http://www.w3.org/2001/XMLSchema#integer", true);
 		assertTrue("Literal is not attached to the model",
 				lit.getModel() == model);
 		assertFalse("Literal is in the model", model.containsResource(lit));
 		assertEquals("Language is missing", "", lit.getLanguage());
-		assertEquals( "Wrong datatype URI", "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral", lit.getDatatypeURI());
-		assertEquals("Value is class is wrong", String.class, lit.getValue().getClass());
+		assertEquals("Wrong datatype URI",
+				"http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral",
+				lit.getDatatypeURI());
+		assertEquals("Value is class is wrong", String.class, lit.getValue()
+				.getClass());
 		assertEquals("Int value is wrong", "13", lit.getValue());
-		
-		lit = model.createLiteral( "13" , false );
-		//"13^^http://www.w3.org/2001/XMLSchema#integer", true);
+
+		lit = model.createLiteral("13", false);
+		// "13^^http://www.w3.org/2001/XMLSchema#integer", true);
 		assertTrue("Literal is not attached to the model",
 				lit.getModel() == model);
 		assertFalse("Literal is in the model", model.containsResource(lit));
 		assertEquals("Language is missing", "", lit.getLanguage());
-		assertNull( "Wrong datatype URI", lit.getDatatypeURI());
-		assertEquals("Value is class is wrong", String.class, lit.getValue().getClass());
+		assertNull("Wrong datatype URI", lit.getDatatypeURI());
+		assertEquals("Value is class is wrong", String.class, lit.getValue()
+				.getClass());
 		assertEquals("Int value is wrong", "13", lit.getValue());
 
 	}
@@ -1062,7 +1074,7 @@ public abstract class AbstractModelContr
 	@Test
 	public void testCreateTypedLiteral_Object_RDFDatatype() {
 		Float f = 4.3f;
-		Literal lit = model.createTypedLiteral( f , XSDDatatype.XSDfloat);
+		Literal lit = model.createTypedLiteral(f, XSDDatatype.XSDfloat);
 		assertTrue("List is not attached to the model", lit.getModel() == model);
 		assertFalse("List is in the model", model.containsResource(lit));
 		assertEquals("Language is not empty", "", lit.getLanguage());
@@ -1097,32 +1109,31 @@ public abstract class AbstractModelContr
 
 	@Test
 	public void testDifference() {
-		if (model.supportsSetOperations())
-		{
-		txnBegin(model);
-		modelAdd(
-				model,
-				"a R b; a R 5; a R _1; a R 'foo'; a P 'foo'; _2 R b; _2 R 5; _2 R _1; _2 R 'foo'; _2 P 'foo'");
-		txnCommit(model);
+		if (model.supportsSetOperations()) {
+			txnBegin(model);
+			modelAdd(
+					model,
+					"a R b; a R 5; a R _1; a R 'foo'; a P 'foo'; _2 R b; _2 R 5; _2 R _1; _2 R 'foo'; _2 P 'foo'");
+			txnCommit(model);
 
-		// subset of model
-		Model subset = memModel("a R b; a R 5; a R _1; a R 'foo'; _2 R b; _2 R 5; _2 R _1; _2 R 'foo'");
+			// subset of model
+			Model subset = memModel("a R b; a R 5; a R _1; a R 'foo'; _2 R b; _2 R 5; _2 R _1; _2 R 'foo'");
 
-		// disjoint with model
-		Model disjoint = memModel(" _3 R b; _3 R 5; _3 R _1; _3 R 'foo'");
+			// disjoint with model
+			Model disjoint = memModel(" _3 R b; _3 R 5; _3 R _1; _3 R 'foo'");
 
-		Model result = model.difference(subset);
+			Model result = model.difference(subset);
 
-		assertTrue("model does not contain some results",
-				model.containsAll(result));
-		assertFalse("result contains some subset nodes",
-				result.containsAny(subset));
-
-		result = model.difference(disjoint);
-		assertFalse("result contains some disjoint nodes",
-				result.containsAny(disjoint));
-		assertTrue("model does not contain some results",
-				model.containsAll(result));
+			assertTrue("model does not contain some results",
+					model.containsAll(result));
+			assertFalse("result contains some subset nodes",
+					result.containsAny(subset));
+
+			result = model.difference(disjoint);
+			assertFalse("result contains some disjoint nodes",
+					result.containsAny(disjoint));
+			assertTrue("model does not contain some results",
+					model.containsAll(result));
 		}
 	}
 
@@ -1366,35 +1377,36 @@ public abstract class AbstractModelContr
 	 * is dependent.
 	 */
 	@Test
-	public abstract void testIndependent();
+	public void testIndependent() {
+		assertEquals(getProducer().areIndependent(), model.independent());
+	}
 
 	@Test
 	public void testIntersection() {
-		if (model.supportsSetOperations())
-		{
-		txnBegin(model);
-		modelAdd(
-				model,
-				"a R b; a R 5; a R _1; a R 'foo'; a P 'foo'; _2 R b; _2 R 5; _2 R _1; _2 R 'foo'; _2 P 'foo'");
-		txnCommit(model);
+		if (model.supportsSetOperations()) {
+			txnBegin(model);
+			modelAdd(
+					model,
+					"a R b; a R 5; a R _1; a R 'foo'; a P 'foo'; _2 R b; _2 R 5; _2 R _1; _2 R 'foo'; _2 P 'foo'");
+			txnCommit(model);
 
-		// subset of model
-		Model subset = memModel("a R b; a R 5; a R _1; a R 'foo'; _2 R b; _2 R 5; _2 R _1; _2 R 'foo'");
+			// subset of model
+			Model subset = memModel("a R b; a R 5; a R _1; a R 'foo'; _2 R b; _2 R 5; _2 R _1; _2 R 'foo'");
 
-		// disjoint with model
-		Model disjoint = memModel(" _3 R b; _3 R 5; _3 R _1; _3 R 'foo'");
+			// disjoint with model
+			Model disjoint = memModel(" _3 R b; _3 R 5; _3 R _1; _3 R 'foo'");
 
-		Model result = model.intersection(subset);
+			Model result = model.intersection(subset);
 
-		assertTrue("model does not contain some results",
-				model.containsAll(result));
-		assertTrue("subset does not contain some results",
-				subset.containsAll(result));
-		assertTrue("result does not contain some subset elements",
-				result.containsAll(subset));
+			assertTrue("model does not contain some results",
+					model.containsAll(result));
+			assertTrue("subset does not contain some results",
+					subset.containsAll(result));
+			assertTrue("result does not contain some subset elements",
+					result.containsAll(subset));
 
-		result = model.intersection(disjoint);
-		assertTrue("result contains entries", result.isEmpty());
+			result = model.intersection(disjoint);
+			assertTrue("result contains entries", result.isEmpty());
 		}
 	}
 
@@ -1440,14 +1452,14 @@ public abstract class AbstractModelContr
 		modelAdd(model, "a R b; a R 5; a R _1; _1 P 'foo'; _2 P 'bar'");
 		txnCommit(model);
 
-		Model model2 = modelWithStatements(getModelProducer(),
+		Model model2 = modelWithStatements(getProducer(),
 				"a R b; a R 5; a R _10; _10 P 'foo'; _20 P 'bar'");
 		assertTrue("model is not isomorphic with model2",
 				model.isIsomorphicWith(model2));
 		assertTrue("model2 is not isomorphic with model",
 				model2.isIsomorphicWith(model));
 
-		model2 = modelWithStatements(getModelProducer(),
+		model2 = modelWithStatements(getProducer(),
 				"c R b; c R 5; c R _10; _10 P 'foo'; _20 P 'bar'");
 		assertFalse("model is isomorphic with model2",
 				model.isIsomorphicWith(model2));
@@ -1548,7 +1560,8 @@ public abstract class AbstractModelContr
 		txnBegin(model);
 		modelAdd(model, "a R b; a R 5; a R _1; _1 P 'foo'; _1 R b; _1 R z");
 		txnCommit(model);
-		RDFNode[] nodes = { rdfNode("b"), rdfNode("5"), rdfNode("_1"), rdfNode("z") };
+		RDFNode[] nodes = { rdfNode("b"), rdfNode("5"), rdfNode("_1"),
+				rdfNode("z") };
 
 		List<RDFNode> list = model.listObjectsOfProperty(p).toList();
 		assertEquals("Wrong number of subjects", nodes.length, list.size());
@@ -1722,7 +1735,7 @@ public abstract class AbstractModelContr
 		modelAdd(model, S2);
 		modelAdd(model, S3);
 		Resource anon = model.createResource();
-	    model.createResource("http://example").addProperty(RDF.type, anon);
+		model.createResource("http://example").addProperty(RDF.type, anon);
 		txnCommit(model);
 
 		checkReturns(S1, model.listStatements(null, P, O));
@@ -1739,15 +1752,16 @@ public abstract class AbstractModelContr
 		stmts.addAll(Arrays.asList(statements(S1)));
 		stmts.addAll(Arrays.asList(statements(S1)));
 		// add one for the anonymous statement added programmaticly
-		assertEquals("wrong number of statements", stmts.size()+1, lst.size());
+		assertEquals("wrong number of statements", stmts.size() + 1, lst.size());
 		for (Statement s : stmts) {
 			assertTrue("Missing statement " + s, lst.contains(s));
 		}
-		
+
 		// test locating anonymous nodes
-		assertEquals(1, model.listStatements( null, null, resource("_C") ).toList().size());
-		assertEquals(1, model.listStatements( null, null, anon ).toList().size());
-		
+		assertEquals(1, model.listStatements(null, null, resource("_C"))
+				.toList().size());
+		assertEquals(1, model.listStatements(null, null, anon).toList().size());
+
 	}
 
 	@Test
@@ -1812,12 +1826,14 @@ public abstract class AbstractModelContr
 		// test with null RDF selector
 		lst = model.listStatements(
 				new SimpleSelector(null, null, (RDFNode) null)).toList();
-		assertEquals("Wrong number of statments", (num * num * ent)+num, lst.size());
+		assertEquals("Wrong number of statments", (num * num * ent) + num,
+				lst.size());
 
 		// test with null literal string selector
 		lst = model.listStatements(
 				new SimpleSelector(null, null, (String) null)).toList();
-		assertEquals("Wrong number of statments", (num * num * ent)+num, lst.size());
+		assertEquals("Wrong number of statments", (num * num * ent) + num,
+				lst.size());
 
 		//
 		// Object selectors
@@ -1919,7 +1935,7 @@ public abstract class AbstractModelContr
 
 		lst = model.listStatements(
 				new SimpleSelector(subject[0], null, (RDFNode) null)).toList();
-		assertEquals("Wrong number of statements", (num * ent)+1, lst.size());
+		assertEquals("Wrong number of statements", (num * ent) + 1, lst.size());
 		for (Statement s : lst) {
 			assertEquals("Wrong subject", subject[0], s.getSubject());
 		}
@@ -2082,56 +2098,47 @@ public abstract class AbstractModelContr
 			assertTrue("missing " + r, lst.contains(r));
 		}
 	}
-	
+
 	@Test
-	public void testListSubjects_DoesNoRemove()
-	{
-		final Model m = modelWithStatements(getModelProducer(),
+	public void testListSubjects_DoesNoRemove() {
+		final Model m = modelWithStatements(getProducer(),
 				"a P b; b Q c; c R a");
 		final ResIterator it = m.listSubjects();
 		it.next();
-		try
-		{
+		try {
 			it.remove();
 			Assert.fail("listSubjects should not support .remove()");
-		}
-		catch (final UnsupportedOperationException e)
-		{
+		} catch (final UnsupportedOperationException e) {
 			// expected
 		}
 	}
 
 	@Test
-	public void testListSubjects_WorksAfterRemoveProperties()
-	{
-		final Model m = modelWithStatements(getModelProducer(),
+	public void testListSubjects_WorksAfterRemoveProperties() {
+		final Model m = modelWithStatements(getProducer(),
 				"p1 before terminal; p2 before terminal");
-		txnBegin( m );
+		txnBegin(m);
 		m.createResource("eh:/p1").removeProperties();
-		txnCommit( m );
+		txnCommit(m);
 		assertIsoModels(
-				modelWithStatements(getModelProducer(), "p2 before terminal"), m);
-		Assert.assertEquals(resourceSet("p2"), m.listSubjects()
-				.toSet());
-	}
-	
-	@Test
-	public void testListSubjects_WorksAfterRemovePropertiesWithLots()
-	{
-		final Model m = modelWithStatements(getModelProducer(),
-				"p2 before terminal");
+				modelWithStatements(getProducer(), "p2 before terminal"), m);
+		Assert.assertEquals(resourceSet("p2"), m.listSubjects().toSet());
+	}
+
+	@Test
+	public void testListSubjects_WorksAfterRemovePropertiesWithLots() {
+		final Model m = modelWithStatements(getProducer(), "p2 before terminal");
 		txnBegin(m);
-		for (int i = 0; i < 100; i += 1)
-		{
+		for (int i = 0; i < 100; i += 1) {
 			modelAdd(m, "p1 hasValue " + i);
 		}
 		m.createResource("eh:/p1").removeProperties();
-		txnCommit( m );
+		txnCommit(m);
 		assertIsoModels(
-				modelWithStatements(getModelProducer(), "p2 before terminal"), m);
-		Assert.assertEquals(resourceSet("p2"), m.listSubjects()
-				.toSet());
+				modelWithStatements(getProducer(), "p2 before terminal"), m);
+		Assert.assertEquals(resourceSet("p2"), m.listSubjects().toSet());
 	}
+
 	/**
 	 * List the subjects
 	 * 
@@ -2260,12 +2267,14 @@ public abstract class AbstractModelContr
 		// test with null RDF selector
 		result = model.query(new SimpleSelector(null, null, (RDFNode) null));
 		lst = result.listStatements().toList();
-		assertEquals("Wrong number of statments", (num * num * ent)+num, lst.size());
+		assertEquals("Wrong number of statments", (num * num * ent) + num,
+				lst.size());
 
 		// test with null literal string selector
 		result = model.query(new SimpleSelector(null, null, (String) null));
 		lst = result.listStatements().toList();
-		assertEquals("Wrong number of statments", (num * num * ent)+num, lst.size());
+		assertEquals("Wrong number of statments", (num * num * ent) + num,
+				lst.size());
 
 		//
 		// Object selectors
@@ -2343,8 +2352,7 @@ public abstract class AbstractModelContr
 		}
 
 		// with resource selector
-		result = model.query(new SimpleSelector(null, RDF.type,
-				RDFS.Resource));
+		result = model.query(new SimpleSelector(null, RDF.type, RDFS.Resource));
 		lst = result.listStatements().toList();
 		assertEquals("Wrong number of statements", num, lst.size());
 		for (Statement s : lst) {
@@ -2369,7 +2377,7 @@ public abstract class AbstractModelContr
 		result = model.query(new SimpleSelector(subject[0], null,
 				(RDFNode) null));
 		lst = result.listStatements().toList();
-		assertEquals("Wrong number of statements", (num * ent+1), lst.size());
+		assertEquals("Wrong number of statements", (num * ent + 1), lst.size());
 		for (Statement s : lst) {
 			assertEquals("Wrong subject", subject[0], s.getSubject());
 		}
@@ -2514,22 +2522,22 @@ public abstract class AbstractModelContr
 
 	}
 
-	
-	
 	/**
 	 * Verifies that the reader reads an RDF/XML file.
 	 * 
 	 * <ul>
-	 * <li> URIs in  RDF inside jena are always absolute</li>
-	 * <li>the "base" argument in a read provides the base to make relative URIs absolute.</li>
-	 * <li>If  the "base" on a read is not provided some reasonable value will be constructed 
-	 * (e.g. file name) so there is no way to create an internal representation of a relative
-	 *  URI through the read() methods.</li>
-	 *  <li>the "base" argument in a write provides a mechanism to convert absolute URIs to 
-	 *  relative URIs in that URIs that have a namespace matching the base are written as 
-	 *  relative URIs</li>
-	 *  <li>if the "base" is not provided no conversion to relative URIs will be performed.</li>
-	 *  </ul>
+	 * <li>URIs in RDF inside jena are always absolute</li>
+	 * <li>the "base" argument in a read provides the base to make relative URIs
+	 * absolute.</li>
+	 * <li>If the "base" on a read is not provided some reasonable value will be
+	 * constructed (e.g. file name) so there is no way to create an internal
+	 * representation of a relative URI through the read() methods.</li>
+	 * <li>the "base" argument in a write provides a mechanism to convert
+	 * absolute URIs to relative URIs in that URIs that have a namespace
+	 * matching the base are written as relative URIs</li>
+	 * <li>if the "base" is not provided no conversion to relative URIs will be
+	 * performed.</li>
+	 * </ul>
 	 */
 	@Test
 	public void testRead_InputStream_String() {
@@ -2549,9 +2557,9 @@ public abstract class AbstractModelContr
 				"end graph missing",
 				SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
 						GraphEvents.finishRead })));
-	
-		assertTrue( "Can not find resolved relative statement",
-		model.contains( resource( "foo:/bar/e"), null, (RDFNode)null));
+
+		assertTrue("Can not find resolved relative statement",
+				model.contains(resource("foo:/bar/e"), null, (RDFNode) null));
 
 		is = TestFileData.getRDFInput();
 
@@ -2562,14 +2570,12 @@ public abstract class AbstractModelContr
 		model.removeAll();
 		SL.clear();
 		try {
-		assertSame("read() must return model", model, model.read(is, null));
-		txnCommit(model);
-		fail( "Should have thrown exception because of relative URIs");
-		}
-		catch (Exception expected)
-		{
+			assertSame("read() must return model", model, model.read(is, null));
+			txnCommit(model);
+			fail("Should have thrown exception because of relative URIs");
+		} catch (Exception expected) {
 			// expected
-			txnRollback( model );
+			txnRollback(model);
 		}
 		SL.assertHasStart("someEvent", model, GraphEvents.startRead);
 
@@ -2680,24 +2686,23 @@ public abstract class AbstractModelContr
 		model.removeAll();
 		SL.clear();
 		try {
-		assertSame("read() must return model", model, model.read(reader, null));
-		txnCommit(model);
-		fail( "Should have thrown exception because of relative URIs");
-		}
-		catch (Exception expected)
-		{
+			assertSame("read() must return model", model,
+					model.read(reader, null));
+			txnCommit(model);
+			fail("Should have thrown exception because of relative URIs");
+		} catch (Exception expected) {
 			// expected
-			txnRollback( model );
+			txnRollback(model);
 		}
 		SL.assertHasStart("someEvent", model, GraphEvents.startRead);
-//		assertTrue(
-//				"Start graph missing",
-//				SL.hasStart(Arrays.asList(new Object[] { "someEvent", model,
-//						GraphEvents.startRead })));
-//		assertTrue(
-//				"end graph missing",
-//				SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
-//						GraphEvents.finishRead })));
+		// assertTrue(
+		// "Start graph missing",
+		// SL.hasStart(Arrays.asList(new Object[] { "someEvent", model,
+		// GraphEvents.startRead })));
+		// assertTrue(
+		// "end graph missing",
+		// SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
+		// GraphEvents.finishRead })));
 
 		// FIXME add tests for relative .
 		// Resource s = ResourceFactory.createProperty( null, "e"
@@ -2728,7 +2733,7 @@ public abstract class AbstractModelContr
 				"end graph missing",
 				SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
 						GraphEvents.finishRead })));
-		
+
 		// FIXME add tests for converting relative to base.
 		// assertTrue( "Can not find resolved relative statement",
 		// model.contains( resource( "foo:/bar/e"), property( "foo:/bar/p5")));
@@ -2763,29 +2768,29 @@ public abstract class AbstractModelContr
 	@Test
 	public void testRead_String() throws Exception {
 		String fileName = getFileName("TestReaders.rdf");
-		
-		try {
 
-		model.register(SL);
-		txnBegin(model);
-		assertSame("read() must return model", model, model.read(fileName));
-		txnCommit(model);
+		try {
 
-		assertTrue(
-				"Start graph missing",
-				SL.hasStart(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.startRead })));
-		assertTrue(
-				"end graph missing",
-				SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.finishRead })));
+			model.register(SL);
+			txnBegin(model);
+			assertSame("read() must return model", model, model.read(fileName));
+			txnCommit(model);
 
-		// FIXME add tests for converting relative to base.
-		// assertTrue( "Can not find resolved relative statement",
-		// model.contains( resource( "foo:/bar/e"), property( "foo:/bar/p5")));
-		}
-		finally {
-			new File( fileName ).delete();
+			assertTrue(
+					"Start graph missing",
+					SL.hasStart(Arrays.asList(new Object[] { "someEvent",
+							model, GraphEvents.startRead })));
+			assertTrue(
+					"end graph missing",
+					SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
+							GraphEvents.finishRead })));
+
+			// FIXME add tests for converting relative to base.
+			// assertTrue( "Can not find resolved relative statement",
+			// model.contains( resource( "foo:/bar/e"), property(
+			// "foo:/bar/p5")));
+		} finally {
+			new File(fileName).delete();
 		}
 
 	}
@@ -2793,57 +2798,58 @@ public abstract class AbstractModelContr
 	@Test
 	public void testRead_String_String() throws Exception {
 		String fileName = TestFileData.getTTLName();
-		
+
 		try {
-		model.register(SL);
-		txnBegin(model);
-		assertSame("read() must return model", model,
-				model.read(fileName, "N-TRIPLE"));
-		txnCommit(model);
+			model.register(SL);
+			txnBegin(model);
+			assertSame("read() must return model", model,
+					model.read(fileName, "N-TRIPLE"));
+			txnCommit(model);
 
-		assertTrue(
-				"Start graph missing",
-				SL.hasStart(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.startRead })));
-		assertTrue(
-				"end graph missing",
-				SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.finishRead })));
+			assertTrue(
+					"Start graph missing",
+					SL.hasStart(Arrays.asList(new Object[] { "someEvent",
+							model, GraphEvents.startRead })));
+			assertTrue(
+					"end graph missing",
+					SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
+							GraphEvents.finishRead })));
 		} finally {
-			new File( fileName ).delete();
+			new File(fileName).delete();
 		}
-		
+
 		fileName = TestFileData.getRDFName();
 		try {
-		// FIXME add tests for converting relative to base.
-		// assertTrue( "Can not find resolved relative statement",
-		// model.contains( resource( "foo:/bar/e"), property( "foo:/bar/p5")));
+			// FIXME add tests for converting relative to base.
+			// assertTrue( "Can not find resolved relative statement",
+			// model.contains( resource( "foo:/bar/e"), property(
+			// "foo:/bar/p5")));
 
-		txnBegin(model);
-		model.removeAll();
-		SL.clear();
-		assertSame("read() must return model", model,
-				model.read(fileName, null));
-		txnCommit(model);
-
-		assertTrue(
-				"Start graph missing",
-				SL.hasStart(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.startRead })));
-		assertTrue(
-				"end graph missing",
-				SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.finishRead })));
+			txnBegin(model);
+			model.removeAll();
+			SL.clear();
+			assertSame("read() must return model", model,
+					model.read(fileName, null));
+			txnCommit(model);
 
-		// FIXME add tests for relative .
-		// Resource s = ResourceFactory.createProperty( null, "e"
-		// ).asResource();
-		// Property p = ResourceFactory.createProperty( null, "p5");
-		// assertTrue( "Can not find relative statement", model.contains( s, p
-		// ));
-		}
-		finally {
-			new File( fileName ).delete();
+			assertTrue(
+					"Start graph missing",
+					SL.hasStart(Arrays.asList(new Object[] { "someEvent",
+							model, GraphEvents.startRead })));
+			assertTrue(
+					"end graph missing",
+					SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
+							GraphEvents.finishRead })));
+
+			// FIXME add tests for relative .
+			// Resource s = ResourceFactory.createProperty( null, "e"
+			// ).asResource();
+			// Property p = ResourceFactory.createProperty( null, "p5");
+			// assertTrue( "Can not find relative statement", model.contains( s,
+			// p
+			// ));
+		} finally {
+			new File(fileName).delete();
 		}
 
 	}
@@ -2853,52 +2859,53 @@ public abstract class AbstractModelContr
 
 		String fileName = TestFileData.getTTLName();
 		try {
-		String lang = "N-TRIPLE";
+			String lang = "N-TRIPLE";
 
-		model.register(SL);
-		txnBegin(model);
-		assertSame("read() must return model", model,
-				model.read(fileName, "foo:/bar/", lang));
-		txnCommit(model);
-
-		assertTrue(
-				"Start graph missing",
-				SL.hasStart(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.startRead })));
-		assertTrue(
-				"end graph missing",
-				SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.finishRead })));
+			model.register(SL);
+			txnBegin(model);
+			assertSame("read() must return model", model,
+					model.read(fileName, "foo:/bar/", lang));
+			txnCommit(model);
 
-		// FIXME add tests for converting relative to base.
-		// assertTrue( "Can not find resolved relative statement",
-		// model.contains( resource( "foo:/bar/e"), property( "foo:/bar/p5")));
+			assertTrue(
+					"Start graph missing",
+					SL.hasStart(Arrays.asList(new Object[] { "someEvent",
+							model, GraphEvents.startRead })));
+			assertTrue(
+					"end graph missing",
+					SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
+							GraphEvents.finishRead })));
+
+			// FIXME add tests for converting relative to base.
+			// assertTrue( "Can not find resolved relative statement",
+			// model.contains( resource( "foo:/bar/e"), property(
+			// "foo:/bar/p5")));
 
-		txnBegin(model);
-		model.removeAll();
-		SL.clear();
-		assertSame("read() must return model", model,
-				model.read(fileName, null, lang));
-		txnCommit(model);
-
-		assertTrue(
-				"Start graph missing",
-				SL.hasStart(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.startRead })));
-		assertTrue(
-				"end graph missing",
-				SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
-						GraphEvents.finishRead })));
+			txnBegin(model);
+			model.removeAll();
+			SL.clear();
+			assertSame("read() must return model", model,
+					model.read(fileName, null, lang));
+			txnCommit(model);
 
-		// FIXME add tests for relative .
-		// Resource s = ResourceFactory.createProperty( null, "e"
-		// ).asResource();
-		// Property p = ResourceFactory.createProperty( null, "p5");
-		// assertTrue( "Can not find relative statement", model.contains( s, p
-		// ));
-		}
-		finally {
-			new File( fileName ).delete();
+			assertTrue(
+					"Start graph missing",
+					SL.hasStart(Arrays.asList(new Object[] { "someEvent",
+							model, GraphEvents.startRead })));
+			assertTrue(
+					"end graph missing",
+					SL.hasEnd(Arrays.asList(new Object[] { "someEvent", model,
+							GraphEvents.finishRead })));
+
+			// FIXME add tests for relative .
+			// Resource s = ResourceFactory.createProperty( null, "e"
+			// ).asResource();
+			// Property p = ResourceFactory.createProperty( null, "p5");
+			// assertTrue( "Can not find relative statement", model.contains( s,
+			// p
+			// ));
+		} finally {
+			new File(fileName).delete();
 		}
 	}
 
@@ -3129,32 +3136,34 @@ public abstract class AbstractModelContr
 			assertFalse("Listener recorded " + s, SL.contains(s));
 		}
 	}
-	
+
 	@Test
-	public void testRemoveAllReifications_Statement()
-	{
+	public void testRemoveAllReifications_Statement() {
 		Statement s = statement("S P O");
 		txnBegin(model);
-		modelAdd( model, "S P O; S P2 O2; S2 P O");		
+		modelAdd(model, "S P O; S P2 O2; S2 P O");
 		model.createReifiedStatement("foo:bar", s);
 		model.createReifiedStatement("foo:bap", s);
-		model.createReifiedStatement("foo:baz", statement( "S P2 O"));
+		model.createReifiedStatement("foo:baz", statement("S P2 O"));
 		txnCommit(model);
-		
+
 		model.register(SL);
 		txnBegin(model);
 		model.removeAllReifications(s);
-		
-		Statement[] removed = { statement( "foo:bar rdf:subject S" ), statement( "foo:bar rdf:predicate P" ), statement( "foo:bar rdf:object O" ), 
-				statement( "foo:bar rdf:type rdf:Statement"),
-				statement( "foo:bap rdf:subject S" ), statement( "foo:bap rdf:predicate P" ), statement( "foo:bap rdf:object O" ), 
-				statement( "foo:bap rdf:type rdf:Statement")};
-		
-		for (Statement stmt : removed)
-		{
-			assertTrue( "Missing remove "+stmt, SL.contains( "remove", stmt ));
+
+		Statement[] removed = { statement("foo:bar rdf:subject S"),
+				statement("foo:bar rdf:predicate P"),
+				statement("foo:bar rdf:object O"),
+				statement("foo:bar rdf:type rdf:Statement"),
+				statement("foo:bap rdf:subject S"),
+				statement("foo:bap rdf:predicate P"),
+				statement("foo:bap rdf:object O"),
+				statement("foo:bap rdf:type rdf:Statement") };
+
+		for (Statement stmt : removed) {
+			assertTrue("Missing remove " + stmt, SL.contains("remove", stmt));
 		}
-	
+
 		// verify remaining reificaiton exists
 		List<ReifiedStatement> rsList = model.listReifiedStatements().toList();
 		assertEquals("Statement was not reified", 1, rsList.size());
@@ -3163,86 +3172,85 @@ public abstract class AbstractModelContr
 	}
 
 	@Test
-	public void testRemoveReification_ReifiedStatement()
-	{
+	public void testRemoveReification_ReifiedStatement() {
 		Statement s = statement("S P O");
 		txnBegin(model);
-		modelAdd( model, "S P O; S P2 O2; S2 P O");		
+		modelAdd(model, "S P O; S P2 O2; S2 P O");
 		ReifiedStatement rs = model.createReifiedStatement("foo:bar", s);
 		model.createReifiedStatement("foo:bap", s);
-		model.createReifiedStatement("foo:baz", statement( "S P2 O"));
+		model.createReifiedStatement("foo:baz", statement("S P2 O"));
 		txnCommit(model);
-		
+
 		model.register(SL);
 		txnBegin(model);
 		model.removeReification(rs);
-		
-		Statement[] removed = { statement( "foo:bar rdf:subject S" ), statement( "foo:bar rdf:predicate P" ), statement( "foo:bar rdf:object O" ), 
-				statement( "foo:bar rdf:type rdf:Statement")
-				};
-		
-		for (Statement stmt : removed)
-		{
-			assertTrue( "Missing remove "+stmt, SL.contains( "remove", stmt ));
+
+		Statement[] removed = { statement("foo:bar rdf:subject S"),
+				statement("foo:bar rdf:predicate P"),
+				statement("foo:bar rdf:object O"),
+				statement("foo:bar rdf:type rdf:Statement") };
+
+		for (Statement stmt : removed) {
+			assertTrue("Missing remove " + stmt, SL.contains("remove", stmt));
 		}
-	
+
 		// verify remaining reificaiton exists
 		List<ReifiedStatement> rsList = model.listReifiedStatements().toList();
 		assertEquals("Statement was not reified", 2, rsList.size());
 		assertNotEquals(rsList.get(0).getURI(), rsList.get(1).getURI());
-		List<String> lst = Arrays.asList( new String[]{"foo:baz", "foo:bap"});
-		assertTrue( "Unexpected "+ rsList.get(0).getURI(), lst.contains( rsList.get(0).getURI() ));
-		assertTrue( "Unexpected "+ rsList.get(1).getURI(), lst.contains( rsList.get(1).getURI() ));
+		List<String> lst = Arrays.asList(new String[] { "foo:baz", "foo:bap" });
+		assertTrue("Unexpected " + rsList.get(0).getURI(),
+				lst.contains(rsList.get(0).getURI()));
+		assertTrue("Unexpected " + rsList.get(1).getURI(),
+				lst.contains(rsList.get(1).getURI()));
 	}
-	
+
 	/**
-	 * size will return the number of statements in a concrete model, for a virtualized model such as one created by an 
-	 * inference engine, it will return an estimated lower bound for the numberof statements in the model but it is 
-	 * possible for a subsequent listStatements on such a model to discover more statements than size() indicated.
+	 * size will return the number of statements in a concrete model, for a
+	 * virtualized model such as one created by an inference engine, it will
+	 * return an estimated lower bound for the numberof statements in the model
+	 * but it is possible for a subsequent listStatements on such a model to
+	 * discover more statements than size() indicated.
 	 */
 	@Test
-	public void testSize()
-	{
+	public void testSize() {
 		txnBegin(model);
 		modelAdd(model, "a P 1; b P 2; c P 3; a P2 'foo'; c P 2");
 		txnCommit(model);
-		assertTrue( "Size is reported too small", 5<=model.size());
+		assertTrue("Size is reported too small", 5 <= model.size());
 	}
-	
+
 	@Test
 	public void testSupportsSetOperations() {
-		Model m = memModel( "S P O");
-		if (model.supportsSetOperations())
-		{
+		Model m = memModel("S P O");
+		if (model.supportsSetOperations()) {
 			// these should all work
-			model.union( m );
-			model.intersection( m );
-			model.difference( m );
-		}
-		else
-		{
+			model.union(m);
+			model.intersection(m);
+			model.difference(m);
+		} else {
 			// these should throw exceptions
 			try {
-				model.union( m );
-				fail( "Should have thrown UnsupportedOperationException");
+				model.union(m);
+				fail("Should have thrown UnsupportedOperationException");
 			} catch (UnsupportedOperationException expected) {
 				// expected
 			}
 			try {
-				model.intersection( m );
-				fail( "Should have thrown UnsupportedOperationException");
+				model.intersection(m);
+				fail("Should have thrown UnsupportedOperationException");
 			} catch (UnsupportedOperationException expected) {
 				// expected
 			}
 			try {
-				model.difference( m );
-				fail( "Should have thrown UnsupportedOperationException");
+				model.difference(m);
+				fail("Should have thrown UnsupportedOperationException");
 			} catch (UnsupportedOperationException expected) {
 				// expected
 			}
 		}
 	}
-	
+
 	@Test
 	public void testSupportsTransactions() {
 		if (model.supportsTransactions()) {
@@ -3256,7 +3264,7 @@ public abstract class AbstractModelContr
 		} else {
 			try {
 				model.begin();
-				fail( "Should have thrown UnsupportedOperationException");
+				fail("Should have thrown UnsupportedOperationException");
 			} catch (UnsupportedOperationException expected) {
 				// expected
 			}
@@ -3264,10 +3272,8 @@ public abstract class AbstractModelContr
 	}
 
 	@Test
-	public void testUnion()
-	{
-		if (model.supportsSetOperations())
-		{
+	public void testUnion() {
+		if (model.supportsSetOperations()) {
 			txnBegin(model);
 			modelAdd(
 					model,
@@ -3281,246 +3287,254 @@ public abstract class AbstractModelContr
 			Model disjoint = memModel(" _3 R b; _3 R 5; _3 R _1; _3 R 'foo'");
 
 			Model result = model.union(subset);
-			
+
 			assertTrue("result does not contain some model statements",
 					result.containsAll(model));
 
-			assertEquals( "Wrong number of statements", 10, result.listStatements().toList().size() );
+			assertEquals("Wrong number of statements", 10, result
+					.listStatements().toList().size());
 
-			result = model.union( disjoint );
+			result = model.union(disjoint);
 			assertTrue("result does not contain some model statements",
 					result.containsAll(model));
 			assertTrue("result does not contain some disjoint statements",
 					result.containsAll(disjoint));
-			
-			assertEquals( "Wrong number of statements", 14, result.listStatements().toList().size() );
+
+			assertEquals("Wrong number of statements", 14, result
+					.listStatements().toList().size());
 		}
 	}
-	
+
 	@Test
 	public void testUnregister_ModelChangedListener() {
 		// adding and removed results in no reports
 		model.register(SL);
-		assertSame( "Unregister must return the model", model, model.unregister(SL));
-		txnBegin( model );
+		assertSame("Unregister must return the model", model,
+				model.unregister(SL));
+		txnBegin(model);
 		model.add(statement("X R 1"));
-		txnCommit( model );
+		txnCommit(model);
 		SL.assertHas(new Object[] {});
-		
+
 		// adding 2x an removed results in 1 reports
 		SL.clear();
 		model.register(SL);
 		model.register(SL);
 		model.unregister(SL);
-		txnBegin( model );
+		txnBegin(model);
 		model.add(statement("X R 2"));
-		txnCommit( model );
+		txnCommit(model);
 		SL.assertHas(new Object[] { "add", statement("X R 2") });
-		
+
 		// removing all +1 does not result in an error
-		model.unregister(SL); // remove the one 
+		model.unregister(SL); // remove the one
 		model.unregister(SL); // remove one that does not exist
-		
-		txnBegin( model );
+
+		txnBegin(model);
 		model.add(statement("X R 3"));
-		txnCommit( model );
-				
+		txnCommit(model);
+
 	}
 
 	@Test
-	public void testWrite_OutputStream() throws Exception
-	{
+	public void testWrite_OutputStream() throws Exception {
 		txnBegin(model);
-		modelAdd(model,
-				"S P O; S P2 _1; S P3 'foo'");
-		txnCommit(model);	
-		
+		modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
+		txnCommit(model);
+
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		
-		model.write( baos );
-		
+
+		model.write(baos);
+
 		// parse as XML and do xpath to see if the items exist
-		ByteArrayInputStream bais = new ByteArrayInputStream( baos.toByteArray());
+		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 		DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
 		dbFactory.setNamespaceAware(true);
 		DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
 		Document doc = dBuilder.parse(bais);
-		XPath xPath =  XPathFactory.newInstance().newXPath();
+		XPath xPath = XPathFactory.newInstance().newXPath();
 		xPath.setNamespaceContext(new HardcodedNamespaceResolver());
 
-		//org.w3c.dom.Node n = (org.w3c.dom.Node) xPath.compile("//rdf:Descripiton[@rdf:about='eh:/S']").evaluate(doc, XPathConstants.NODE);
-		org.w3c.dom.Node desc = (org.w3c.dom.Node) xPath.compile( "//rdf:Description[contains(@rdf:about, 'eh:/S')]").evaluate(doc, XPathConstants.NODE);
-		assertNotNull( "Can not find the subject eh:/S", desc );
-		org.w3c.dom.Node n = (org.w3c.dom.Node) xPath.compile( "eh:P3").evaluate(desc, XPathConstants.NODE);
-		assertNotNull( "Can not find eh:P3", n );
-		assertEquals( "P3 not saved correctly", "foo", n.getTextContent());
-
-		n = (org.w3c.dom.Node) xPath.compile( "eh:P[contains(@rdf:resource,'eh:/O')]").evaluate(desc, XPathConstants.NODE);
-		assertNotNull( "Can not find eh:P", n );
-		
-		n = (org.w3c.dom.Node) xPath.compile( "eh:P2/@rdf:nodeID").evaluate(desc, XPathConstants.NODE);
-		assertNotNull( "Can not find eh:P2", n );
+		// org.w3c.dom.Node n = (org.w3c.dom.Node)
+		// xPath.compile("//rdf:Descripiton[@rdf:about='eh:/S']").evaluate(doc,
+		// XPathConstants.NODE);
+		org.w3c.dom.Node desc = (org.w3c.dom.Node) xPath.compile(
+				"//rdf:Description[contains(@rdf:about, 'eh:/S')]").evaluate(
+				doc, XPathConstants.NODE);
+		assertNotNull("Can not find the subject eh:/S", desc);
+		org.w3c.dom.Node n = (org.w3c.dom.Node) xPath.compile("eh:P3")
+				.evaluate(desc, XPathConstants.NODE);
+		assertNotNull("Can not find eh:P3", n);
+		assertEquals("P3 not saved correctly", "foo", n.getTextContent());
+
+		n = (org.w3c.dom.Node) xPath.compile(
+				"eh:P[contains(@rdf:resource,'eh:/O')]").evaluate(desc,
+				XPathConstants.NODE);
+		assertNotNull("Can not find eh:P", n);
+
+		n = (org.w3c.dom.Node) xPath.compile("eh:P2/@rdf:nodeID").evaluate(
+				desc, XPathConstants.NODE);
+		assertNotNull("Can not find eh:P2", n);
 	}
-	
+
 	private class HardcodedNamespaceResolver implements NamespaceContext {
 
-	    /**
-	     * This method returns the uri for all prefixes needed. Wherever possible
-	     * it uses XMLConstants.
-	     * 
-	     * @param prefix
-	     * @return uri
-	     */
-	    @Override
+		/**
+		 * This method returns the uri for all prefixes needed. Wherever
+		 * possible it uses XMLConstants.
+		 * 
+		 * @param prefix
+		 * @return uri
+		 */
+		@Override
 		public String getNamespaceURI(String prefix) {
-	        if (prefix == null) {
-	            throw new IllegalArgumentException("No prefix provided!");
-	        } else if (prefix.equals("rdf")) {
-	            return "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
-	        } else if (prefix.equals("eh")) {
-	        	return "eh:/";
-	        } else {
-	            return XMLConstants.NULL_NS_URI;
-	        }
-	    }
+			if (prefix == null) {
+				throw new IllegalArgumentException("No prefix provided!");
+			} else if (prefix.equals("rdf")) {
+				return "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+			} else if (prefix.equals("eh")) {
+				return "eh:/";
+			} else {
+				return XMLConstants.NULL_NS_URI;
+			}
+		}
 
-	    @Override
+		@Override
 		public String getPrefix(String namespaceURI) {
-	        // Not needed in this context.
-	        return null;
-	    }
+			// Not needed in this context.
+			return null;
+		}
 
-	    @Override
+		@Override
 		public Iterator<String> getPrefixes(String namespaceURI) {
-	        // Not needed in this context.
-	        return null;
-	    }
+			// Not needed in this context.
+			return null;
+		}
 
 	}
-	   
+
 	@Test
-	public void testWrite_OutputStream_String() throws Exception
-	{
+	public void testWrite_OutputStream_String() throws Exception {
 		txnBegin(model);
-		modelAdd(model,
-				"S P O; S P2 _1; S P3 'foo'");
-		txnCommit(model);	
-		
+		modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
+		txnCommit(model);
+
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		
-		model.write( baos, "N-TRIPLES" );
-		
+
+		model.write(baos, "N-TRIPLES");
+
 		String result = baos.toString();
-		
-		assertTrue( "Missing P3", result.contains( "<eh:/S> <eh:/P3> \"foo\""));
-		assertTrue( "Missing P2", result.contains( "<eh:/S> <eh:/P2> _:"));
-		assertTrue( "Missing P", result.contains( "<eh:/S> <eh:/P> <eh:/O>"));
-		
+
+		assertTrue("Missing P3", result.contains("<eh:/S> <eh:/P3> \"foo\""));
+		assertTrue("Missing P2", result.contains("<eh:/S> <eh:/P2> _:"));
+		assertTrue("Missing P", result.contains("<eh:/S> <eh:/P> <eh:/O>"));
+
 	}
 
 	@Test
-	public void testWrite_OutputStream_String_String() throws Exception
-	{
+	public void testWrite_OutputStream_String_String() throws Exception {
 		txnBegin(model);
-		modelAdd(model,
-				"S P O; S P2 _1; S P3 'foo'");
-		model.add( resource("S"), property("P4"), model.createResource("A"));
-		txnCommit(model);	
-		
+		modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
+		model.add(resource("S"), property("P4"), model.createResource("A"));
+		txnCommit(model);
+
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		
-		model.write( baos, "N-TRIPLES", "foo://bar" );
-		
+
+		model.write(baos, "N-TRIPLES", "foo://bar");
+
 		String result = baos.toString();
-		
-		assertTrue( "Missing P3", result.contains( "<eh:/S> <eh:/P3> \"foo\""));
-		assertTrue( "Missing P2", result.contains( "<eh:/S> <eh:/P2> _:"));
-		assertTrue( "Missing P", result.contains( "<eh:/S> <eh:/P> <eh:/O>"));
+
+		assertTrue("Missing P3", result.contains("<eh:/S> <eh:/P3> \"foo\""));
+		assertTrue("Missing P2", result.contains("<eh:/S> <eh:/P2> _:"));
+		assertTrue("Missing P", result.contains("<eh:/S> <eh:/P> <eh:/O>"));
 		// TODO figure out how to work iwth base
-		// assertTrue( "Missing P3", result.contains( "<eh:/S> <eh:/P3> <foo://bar/A>"));
-		
+		// assertTrue( "Missing P3", result.contains(
+		// "<eh:/S> <eh:/P3> <foo://bar/A>"));
+
 	}
-	
+
 	@Test
-	public void testWrite_Writer() throws Exception
-	{
+	public void testWrite_Writer() throws Exception {
 		txnBegin(model);
-		modelAdd(model,
-				"S P O; S P2 _1; S P3 'foo'");
-		txnCommit(model);	
-		
+		modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
+		txnCommit(model);
+
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		Writer writer = new OutputStreamWriter( baos );
-		
-		model.write( writer );
-		
+		Writer writer = new OutputStreamWriter(baos);
+
+		model.write(writer);
+
 		// parse as XML and do xpaht to see if the items exist
-		ByteArrayInputStream bais = new ByteArrayInputStream( baos.toByteArray());
+		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
 		DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
 		dbFactory.setNamespaceAware(true);
 		DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
 		Document doc = dBuilder.parse(bais);
-		XPath xPath =  XPathFactory.newInstance().newXPath();
+		XPath xPath = XPathFactory.newInstance().newXPath();
 		xPath.setNamespaceContext(new HardcodedNamespaceResolver());
 
-		//org.w3c.dom.Node n = (org.w3c.dom.Node) xPath.compile("//rdf:Descripiton[@rdf:about='eh:/S']").evaluate(doc, XPathConstants.NODE);
-		org.w3c.dom.Node desc = (org.w3c.dom.Node) xPath.compile( "//rdf:Description[contains(@rdf:about, 'eh:/S')]").evaluate(doc, XPathConstants.NODE);
-		assertNotNull( "Can not find the subject eh:/S", desc );
-		org.w3c.dom.Node n = (org.w3c.dom.Node) xPath.compile( "eh:P3").evaluate(desc, XPathConstants.NODE);
-		assertNotNull( "Can not find eh:P3", n );
-		assertEquals( "P3 not saved correctly", "foo", n.getTextContent());
-
-		n = (org.w3c.dom.Node) xPath.compile( "eh:P[contains(@rdf:resource,'eh:/O')]").evaluate(desc, XPathConstants.NODE);
-		assertNotNull( "Can not find eh:P", n );
-		
-		n = (org.w3c.dom.Node) xPath.compile( "eh:P2/@rdf:nodeID").evaluate(desc, XPathConstants.NODE);
-		assertNotNull( "Can not find eh:P2", n );
+		// org.w3c.dom.Node n = (org.w3c.dom.Node)
+		// xPath.compile("//rdf:Descripiton[@rdf:about='eh:/S']").evaluate(doc,
+		// XPathConstants.NODE);
+		org.w3c.dom.Node desc = (org.w3c.dom.Node) xPath.compile(
+				"//rdf:Description[contains(@rdf:about, 'eh:/S')]").evaluate(
+				doc, XPathConstants.NODE);
+		assertNotNull("Can not find the subject eh:/S", desc);
+		org.w3c.dom.Node n = (org.w3c.dom.Node) xPath.compile("eh:P3")
+				.evaluate(desc, XPathConstants.NODE);
+		assertNotNull("Can not find eh:P3", n);
+		assertEquals("P3 not saved correctly", "foo", n.getTextContent());
+
+		n = (org.w3c.dom.Node) xPath.compile(
+				"eh:P[contains(@rdf:resource,'eh:/O')]").evaluate(desc,
+				XPathConstants.NODE);
+		assertNotNull("Can not find eh:P", n);
+
+		n = (org.w3c.dom.Node) xPath.compile("eh:P2/@rdf:nodeID").evaluate(
+				desc, XPathConstants.NODE);
+		assertNotNull("Can not find eh:P2", n);
 	}
-	
+
 	@Test
-	public void testWrite_Writer_String() throws Exception
-	{
+	public void testWrite_Writer_String() throws Exception {
 		txnBegin(model);
-		modelAdd(model,
-				"S P O; S P2 _1; S P3 'foo'");
-		txnCommit(model);	
-		
+		modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
+		txnCommit(model);
+
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		Writer writer = new OutputStreamWriter( baos );
-		
-		model.write( writer, "N-TRIPLES" );
-		
+		Writer writer = new OutputStreamWriter(baos);
+
+		model.write(writer, "N-TRIPLES");
+
 		String result = baos.toString();
-		
-		assertTrue( "Missing P3", result.contains( "<eh:/S> <eh:/P3> \"foo\""));
-		assertTrue( "Missing P2", result.contains( "<eh:/S> <eh:/P2> _:"));
-		assertTrue( "Missing P", result.contains( "<eh:/S> <eh:/P> <eh:/O>"));
-		
+
+		assertTrue("Missing P3", result.contains("<eh:/S> <eh:/P3> \"foo\""));
+		assertTrue("Missing P2", result.contains("<eh:/S> <eh:/P2> _:"));
+		assertTrue("Missing P", result.contains("<eh:/S> <eh:/P> <eh:/O>"));
+
 	}
 
 	@Test
-	public void testWrite_Writer_String_String() throws Exception
-	{
+	public void testWrite_Writer_String_String() throws Exception {
 		txnBegin(model);
-		modelAdd(model,
-				"S P O; S P2 _1; S P3 'foo'");
-		model.add( resource("S"), property("P4"), model.createResource("A"));
-		txnCommit(model);	
-		
+		modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
+		model.add(resource("S"), property("P4"), model.createResource("A"));
+		txnCommit(model);
+
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		Writer writer = new OutputStreamWriter( baos );
-		
-		model.write( writer, "N-TRIPLES", "foo://bar/" );
-		
+		Writer writer = new OutputStreamWriter(baos);
+
+		model.write(writer, "N-TRIPLES", "foo://bar/");
+
 		String result = baos.toString();
-		
-		assertTrue( "Missing P3", result.contains( "<eh:/S> <eh:/P3> \"foo\""));
-		assertTrue( "Missing P2", result.contains( "<eh:/S> <eh:/P2> _:"));
-		assertTrue( "Missing P", result.contains( "<eh:/S> <eh:/P> <eh:/O>"));
+
+		assertTrue("Missing P3", result.contains("<eh:/S> <eh:/P3> \"foo\""));
+		assertTrue("Missing P2", result.contains("<eh:/S> <eh:/P2> _:"));
+		assertTrue("Missing P", result.contains("<eh:/S> <eh:/P> <eh:/O>"));
 		// TODO figure out how to work iwth base
-		// assertTrue( "Missing P3", result.contains( "<eh:/S> <eh:/P3> <foo://bar/A>"));
-		
+		// assertTrue( "Missing P3", result.contains(
+		// "<eh:/S> <eh:/P3> <foo://bar/A>"));
+
 	}
-	
-	
+
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelFactoryTest.java Wed Oct  9 17:16:15 2013
@@ -31,62 +31,51 @@ import com.hp.hpl.jena.reasoner.rulesys.
 import com.hp.hpl.jena.reasoner.rulesys.Rule;
 import com.hp.hpl.jena.shared.PrefixMapping;
 import com.hp.hpl.jena.test.JenaTestBase;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducerUser;
-import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
-
 import org.junit.Assert;
 import org.junit.Test;
 
 /**
- * Tests the ModelFactory code. Very skeletal at the moment. It's really
- * testing that the methods actually exists, but it doesn't check much in
- * the way of behaviour.
+ * Tests the ModelFactory code. Very skeletal at the moment. It's really testing
+ * that the methods actually exists, but it doesn't check much in the way of
+ * behaviour.
  * 
  */
 
-public class ModelFactoryTest 
-{
+public class ModelFactoryTest {
 
 	@Test
-	public void testAssembleModelFromModel()
-	{
-		// TODO Assert.assertNotNull( ModelFactory.assembleModelFrom( ModelFactory.createDefaultModel()) );
+	public void testAssembleModelFromModel() {
+		// TODO Assert.assertNotNull( ModelFactory.assembleModelFrom(
+		// ModelFactory.createDefaultModel()) );
 	}
 
 	@Test
-	public void testAssmbleModelFromRoot()
-	{
+	public void testAssmbleModelFromRoot() {
 		// TODO Model assembleModelFrom( Resource root )
 	}
 
 	/**
 	 * Test that ModelFactory.createDefaultModel() exists. [Should check that
-	 * the Model
-	 * is truly a "default" model.]
+	 * the Model is truly a "default" model.]
 	 */
 	@Test
-	public void testCreateDefaultModel()
-	{
+	public void testCreateDefaultModel() {
 		Model m = ModelFactory.createDefaultModel();
 		try {
 			Assert.assertNotNull(m);
-		}
-		finally {
-			if (m != null)
-			{
+		} finally {
+			if (m != null) {
 				m.close();
 			}
 		}
 	}
 
 	@Test
-	public void testCreateInfModel()
-	{
+	public void testCreateInfModel() {
 		Model model = ModelFactory.createDefaultModel();
 		final String rule = "-> (eg:r eg:p eg:v).";
 		final Reasoner r = new GenericRuleReasoner(Rule.parseRules(rule));
-		final InfGraph ig = r
-				.bind(model.getGraph());
+		final InfGraph ig = r.bind(model.getGraph());
 		final InfModel im = ModelFactory.createInfModel(ig);
 		JenaTestBase.assertInstanceOf(InfModel.class, im);
 		Assert.assertEquals(1, im.size());
@@ -97,8 +86,7 @@ public class ModelFactoryTest 
 	 * graphs. (We don't check that Union works - that's done in the Union
 	 * tests, we hope.)
 	 */
-	public void testCreateUnion()
-	{
+	public void testCreateUnion() {
 		final Model m1 = ModelFactory.createDefaultModel();
 		final Model m2 = ModelFactory.createDefaultModel();
 		final Model m = ModelFactory.createUnion(m1, m2);
@@ -107,19 +95,16 @@ public class ModelFactoryTest 
 		Assert.assertSame(m2.getGraph(), ((Union) m.getGraph()).getR());
 	}
 
-	public void testFindAssemblerRoots()
-	{
+	public void testFindAssemblerRoots() {
 		// TODO Set ModelFactory.findAssemblerRoots( Model model )
 	}
 
-	public void testGetDefaultPrefixMapping()
-	{
+	public void testGetDefaultPrefixMapping() {
 		Assert.assertSame(ModelCom.getDefaultModelPrefixes(),
 				ModelFactory.getDefaultModelPrefixes());
 	}
 
-	public void testSetDefaultPrefixMapping()
-	{
+	public void testSetDefaultPrefixMapping() {
 		final PrefixMapping original = ModelCom.getDefaultModelPrefixes();
 		final PrefixMapping pm = PrefixMapping.Factory.create();
 		ModelFactory.setDefaultModelPrefixes(pm);
@@ -128,5 +113,4 @@ public class ModelFactoryTest 
 		ModelCom.setDefaultModelPrefixes(original);
 	}
 
-	
 }

Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelTestBase.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelTestBase.java?rev=1530718&r1=1530717&r2=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelTestBase.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelTestBase.java Wed Oct  9 17:16:15 2013
@@ -275,4 +275,4 @@
 //		super(name);
 //	}
 //
-//}
+// }

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java (from r1525287, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListContractTests.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListContractTests.java&r1=1525287&r2=1530718&rev=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFListContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java Wed Oct  9 17:16:15 2013
@@ -33,8 +33,7 @@ import com.hp.hpl.jena.rdf.model.Propert
 import com.hp.hpl.jena.rdf.model.RDFList;
 import com.hp.hpl.jena.rdf.model.RDFNode;
 import com.hp.hpl.jena.rdf.model.Resource;
-import com.hp.hpl.jena.testing_framework.AbstractModelProducerUser;
-import com.hp.hpl.jena.testing_framework.ModelProducerInterface;
+import com.hp.hpl.jena.testing_framework.INodeProducer;
 
 import com.hp.hpl.jena.util.iterator.Map1;
 import com.hp.hpl.jena.vocabulary.RDF;
@@ -50,6 +49,7 @@ import org.junit.Test;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.xenei.junit.contract.Contract;
 
 /**
  * <p>
@@ -59,46 +59,39 @@ import org.slf4j.LoggerFactory;
  * 
  * 
  */
-public class AbstractRDFListContractTests extends
-AbstractModelProducerUser  {
-	
-	@Override
-	public ModelProducerInterface getModelProducer() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
+@Contract(RDFList.class)
+public abstract class RDFListContractTests {
+
+	@Contract.Inject( "org.xenei.junit.contract.IProducer<%s>" )
+	abstract public INodeProducer<RDFList> getListProducer();
+
 	private Model model;
-	
+
 	@Before
-	final public void setupAbstractRDFListTest()
-	{
-		model = getModelProducer().newModel();	
+	final public void beforeRDFListContractTests() {
+		model = getListProducer().getModel();
 	}
-	
+
 	// Constants
 	// ////////////////////////////////
 
 	public static final String NS = "uri:urn:x-rdf:test#";
 
 	/** Test that an iterator delivers the expected values */
-	protected static void iteratorTest( final Iterator<?> i,
-			final Object[] expected )
-	{
-		final Logger logger = LoggerFactory.getLogger(AbstractRDFListContractTests.class);
+	protected static void iteratorTest(final Iterator<?> i,
+			final Object[] expected) {
+		final Logger logger = LoggerFactory
+				.getLogger(RDFListContractTests.class);
 		final List<Object> expList = new ArrayList<Object>();
-		for (final Object element : expected)
-		{
+		for (final Object element : expected) {
 			expList.add(element);
 		}
 
-		while (i.hasNext())
-		{
+		while (i.hasNext()) {
 			final Object next = i.next();
 
 			// debugging
-			if (!expList.contains(next))
-			{
+			if (!expList.contains(next)) {
 				logger.debug("TestList - Unexpected iterator result: " + next);
 			}
 
@@ -109,11 +102,9 @@ AbstractModelProducerUser  {
 					+ " was not removed from the list ", expList.remove(next));
 		}
 
-		if (!(expList.size() == 0))
-		{
+		if (!(expList.size() == 0)) {
 			logger.debug("TestList - Expected iterator results not found");
-			for (final Object object : expList)
-			{
+			for (final Object object : expList) {
 				logger.debug("TestList - missing: " + object);
 			}
 		}
@@ -138,42 +129,26 @@ AbstractModelProducerUser  {
 	// External signature methods
 	// ////////////////////////////////
 	/*
-	 * public static TestSuite suite() {
-	 * TestSuite s = new TestSuite( "TestList" );
-	 * TestList tl = new TestList();
-	 * for (int i = 0; i <= 5; i++) {
-	 * s.addTest( new CountTest( i ) );
-	 * s.addTest( new TailTest( i ) );
-	 * }
+	 * public static TestSuite suite() { TestSuite s = new TestSuite( "TestList"
+	 * ); TestList tl = new TestList(); for (int i = 0; i <= 5; i++) {
+	 * s.addTest( new CountTest( i ) ); s.addTest( new TailTest( i ) ); }
 	 * 
-	 * s.addTest( new ValidityTest() );
-	 * s.addTest( new HeadTest() );
-	 * s.addTest( new SetHeadTest() );
-	 * s.addTest( new SetTailTest() );
-	 * s.addTest( new ConsTest() );
-	 * s.addTest( new AddTest() );
-	 * s.addTest( new TestListGet() );
-	 * s.addTest( new ReplaceTest() );
-	 * s.addTest( new IndexTest1() );
-	 * s.addTest( new IndexTest2() );
-	 * s.addTest( new AppendTest() );
-	 * s.addTest( new ConcatenateTest() );
-	 * s.addTest( new ConcatenateTest2() );
-	 * s.addTest( new ApplyTest() );
-	 * s.addTest( new ReduceTest() );
-	 * s.addTest( new RemoveTest() );
-	 * s.addTest( new Map1Test() );
-	 * s.addTest( new ListEqualsTest() );
-	 * s.addTest( new ListSubclassTest() );
-	 * s.addTest( new UserDefinedListTest() );
+	 * s.addTest( new ValidityTest() ); s.addTest( new HeadTest() ); s.addTest(
+	 * new SetHeadTest() ); s.addTest( new SetTailTest() ); s.addTest( new
+	 * ConsTest() ); s.addTest( new AddTest() ); s.addTest( new TestListGet() );
+	 * s.addTest( new ReplaceTest() ); s.addTest( new IndexTest1() ); s.addTest(
+	 * new IndexTest2() ); s.addTest( new AppendTest() ); s.addTest( new
+	 * ConcatenateTest() ); s.addTest( new ConcatenateTest2() ); s.addTest( new
+	 * ApplyTest() ); s.addTest( new ReduceTest() ); s.addTest( new RemoveTest()
+	 * ); s.addTest( new Map1Test() ); s.addTest( new ListEqualsTest() );
+	 * s.addTest( new ListSubclassTest() ); s.addTest( new UserDefinedListTest()
+	 * );
 	 * 
-	 * return s;
-	 * }
+	 * return s; }
 	 */
 
-	protected void checkValid( final String testName, final RDFList l,
-			final boolean validExpected )
-	{
+	protected void checkValid(final String testName, final RDFList l,
+			final boolean validExpected) {
 		l.setStrict(true);
 		final boolean valid = l.isValid();
 		// for debugging ... String s = l.getValidityErrorMessage();
@@ -184,13 +159,12 @@ AbstractModelProducerUser  {
 	// Internal implementation methods
 	// ////////////////////////////////
 
-	protected RDFList getListRoot( final Model m )
-	{
-		final Resource root = m.getResource(AbstractRDFListContractTests.NS + "root");
+	protected RDFList getListRoot(final Model m) {
+		final Resource root = m.getResource(RDFListContractTests.NS + "root");
 		Assert.assertNotNull("Root resource should not be null", root);
 
 		final Resource listHead = root.getRequiredProperty(
-				m.getProperty(AbstractRDFListContractTests.NS + "p")).getResource();
+				m.getProperty(RDFListContractTests.NS + "p")).getResource();
 
 		final RDFList l = listHead.as(RDFList.class);
 		Assert.assertNotNull("as(RDFList) should not return null for root", l);
@@ -199,25 +173,24 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testAdd()
-	{
+	public void testAdd() {
 
-		final Resource root = model.createResource(AbstractRDFListContractTests.NS + "root");
-		final Property p = model.createProperty(AbstractRDFListContractTests.NS, "p");
+		final Resource root = model.createResource(RDFListContractTests.NS
+				+ "root");
+		final Property p = model.createProperty(RDFListContractTests.NS, "p");
 
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
 		final Resource[] toAdd = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "a"),
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "d"),
-				model.createResource(AbstractRDFListContractTests.NS + "e"), };
+				model.createResource(RDFListContractTests.NS + "a"),
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "d"),
+				model.createResource(RDFListContractTests.NS + "e"), };
 
 		// add each of these resources onto the end of the list
-		for (final Resource element : toAdd)
-		{
+		for (final Resource element : toAdd) {
 			final RDFList list0 = list.with(element);
 
 			checkValid("addTest0", list0, true);
@@ -232,7 +205,7 @@ AbstractModelProducerUser  {
 
 		// should be isomorphic with list 5
 		final Model m0 = ModelFactory.createDefaultModel();
-		m0.read( getFileName( "ontology/list5.rdf"));
+		m0.read(getFileName("ontology/list5.rdf"));
 
 		Assert.assertTrue("Add'ed and read models should be the same",
 				m0.isIsomorphicWith(model));
@@ -240,18 +213,17 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testAppend()
-	{
+	public void testAppend() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
-		final Resource r = model.createResource(AbstractRDFListContractTests.NS + "foo");
+		final Resource r = model
+				.createResource(RDFListContractTests.NS + "foo");
 
 		// create a list of foos
-		for (int i = 0; i < 5; i++)
-		{
+		for (int i = 0; i < 5; i++) {
 			list = list.cons(r);
 		}
 
@@ -279,19 +251,16 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testApply()
-	{
+	public void testApply() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final RDFList root = getListRoot(model);
 
-		class MyApply implements RDFList.ApplyFn
-		{
+		class MyApply implements RDFList.ApplyFn {
 			String collect = "";
 
 			@Override
-			public void apply( final RDFNode n )
-			{
+			public void apply(final RDFNode n) {
 				collect = collect + ((Resource) n).getLocalName();
 			}
 		}
@@ -306,18 +275,17 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testConcatenate()
-	{
+	public void testConcatenate() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
-		final Resource r = model.createResource(AbstractRDFListContractTests.NS + "foo");
+		final Resource r = model
+				.createResource(RDFListContractTests.NS + "foo");
 
 		// create a list of foos
-		for (int i = 0; i < 5; i++)
-		{
+		for (int i = 0; i < 5; i++) {
 			list = list.cons(r);
 		}
 
@@ -340,18 +308,17 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testConcatenate2()
-	{
+	public void testConcatenate2() {
 		model.read(getFileName("ontology/list5.rdf"));
 
-		final Resource a = model.createResource(AbstractRDFListContractTests.NS + "a");
+		final Resource a = model.createResource(RDFListContractTests.NS + "a");
 
 		// create a list of foos
 		final Resource[] rs = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "d"),
-				model.createResource(AbstractRDFListContractTests.NS + "e") };
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "d"),
+				model.createResource(RDFListContractTests.NS + "e") };
 
 		final RDFList aList = model.createList().cons(a);
 		final RDFList rsList = model.createList(rs);
@@ -366,24 +333,23 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testCons()
-	{
-		final Resource root = model.createResource(AbstractRDFListContractTests.NS + "root");
-		final Property p = model.createProperty(AbstractRDFListContractTests.NS, "p");
+	public void testCons() {
+		final Resource root = model.createResource(RDFListContractTests.NS
+				+ "root");
+		final Property p = model.createProperty(RDFListContractTests.NS, "p");
 
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
 		final Resource[] toAdd = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "e"),
-				model.createResource(AbstractRDFListContractTests.NS + "d"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "a"), };
+				model.createResource(RDFListContractTests.NS + "e"),
+				model.createResource(RDFListContractTests.NS + "d"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "a"), };
 
 		// cons each of these resources onto the front of the list
-		for (final Resource element : toAdd)
-		{
+		for (final Resource element : toAdd) {
 			final RDFList list0 = list.cons(element);
 
 			checkValid("constest1", list0, true);
@@ -405,12 +371,10 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testCount()
-	{
-		for (int i = 0; i <= 5; i++)
-		{
+	public void testCount() {
+		for (int i = 0; i <= 5; i++) {
 			model.removeAll();
-			model.read( getFileName("ontology/list" + i + ".rdf"));
+			model.read(getFileName("ontology/list" + i + ".rdf"));
 
 			final RDFList l0 = getListRoot(model);
 			Assert.assertEquals("List size should be " + i, i, l0.size());
@@ -419,38 +383,35 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testHead()
-	{
+	public void testHead() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		RDFList l0 = getListRoot(model);
 
 		final String[] names = { "a", "b", "c", "d", "e" };
-		for (final String name : names)
-		{
-			Assert.assertEquals("head of list has incorrect URI", AbstractRDFListContractTests.NS
-					+ name, ((Resource) l0.getHead()).getURI());
+		for (final String name : names) {
+			Assert.assertEquals("head of list has incorrect URI",
+					RDFListContractTests.NS + name,
+					((Resource) l0.getHead()).getURI());
 			l0 = l0.getTail();
 		}
 	}
 
 	@Test
-	public void testIndex1()
-	{
+	public void testIndex1() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final Resource[] toGet = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "a"),
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "d"),
-				model.createResource(AbstractRDFListContractTests.NS + "e"), };
+				model.createResource(RDFListContractTests.NS + "a"),
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "d"),
+				model.createResource(RDFListContractTests.NS + "e"), };
 
 		final RDFList l1 = getListRoot(model);
 
 		// check the indexes are correct
-		for (int i = 0; i < toGet.length; i++)
-		{
+		for (int i = 0; i < toGet.length; i++) {
 			Assert.assertTrue("list should contain element " + i,
 					l1.contains(toGet[i]));
 			Assert.assertEquals("list element " + i + " is not correct", i,
@@ -459,23 +420,20 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testIndex2()
-	{
+	public void testIndex2() {
 
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list = nil.as(RDFList.class);
 
-		final Resource r = model.createResource(AbstractRDFListContractTests.NS + "a");
+		final Resource r = model.createResource(RDFListContractTests.NS + "a");
 
 		// cons each a's onto the front of the list
-		for (int i = 0; i < 10; i++)
-		{
+		for (int i = 0; i < 10; i++) {
 			list = list.cons(r);
 		}
 
 		// now index them back again
-		for (int j = 0; j < 10; j++)
-		{
+		for (int j = 0; j < 10; j++) {
 			Assert.assertEquals("index of j'th item should be j", j,
 					list.indexOf(r, j));
 		}
@@ -483,43 +441,43 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testListEquals()
-	{
+	public void testListEquals() {
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		final RDFList nilList = nil.as(RDFList.class);
 
 		// create a list of foos
 		final Resource[] r0 = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "a"), // canonical
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "d"),
-				model.createResource(AbstractRDFListContractTests.NS + "e") };
+				model.createResource(RDFListContractTests.NS + "a"), // canonical
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "d"),
+				model.createResource(RDFListContractTests.NS + "e") };
 		final Resource[] r1 = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "a"), // same
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "d"),
-				model.createResource(AbstractRDFListContractTests.NS + "e") };
+				model.createResource(RDFListContractTests.NS + "a"), // same
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "d"),
+				model.createResource(RDFListContractTests.NS + "e") };
 		final Resource[] r2 = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "a"), // one shorter
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "d") };
+				model.createResource(RDFListContractTests.NS + "a"), // one
+																		// shorter
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "d") };
 		final Resource[] r3 = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "a"), // elements
+				model.createResource(RDFListContractTests.NS + "a"), // elements
 				// swapped
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "d"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "e") };
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "d"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "e") };
 		final Resource[] r4 = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "a"), // different
+				model.createResource(RDFListContractTests.NS + "a"), // different
 				// name
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "D"),
-				model.createResource(AbstractRDFListContractTests.NS + "e") };
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "D"),
+				model.createResource(RDFListContractTests.NS + "e") };
 
 		final Object[][] testSpec = new Object[][] { { r0, r1, Boolean.TRUE },
 				{ r0, r2, Boolean.FALSE }, { r0, r3, Boolean.FALSE },
@@ -527,8 +485,7 @@ AbstractModelProducerUser  {
 				{ r1, r3, Boolean.FALSE }, { r1, r4, Boolean.FALSE },
 				{ r2, r3, Boolean.FALSE }, { r2, r4, Boolean.FALSE }, };
 
-		for (int i = 0; i < testSpec.length; i++)
-		{
+		for (int i = 0; i < testSpec.length; i++) {
 			final RDFList l0 = nilList.append(Arrays.asList(
 					(Resource[]) testSpec[i][0]).iterator());
 			final RDFList l1 = nilList.append(Arrays.asList(
@@ -543,34 +500,29 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testListGet()
-	{
+	public void testListGet() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final Resource[] toGet = new Resource[] {
-				model.createResource(AbstractRDFListContractTests.NS + "a"),
-				model.createResource(AbstractRDFListContractTests.NS + "b"),
-				model.createResource(AbstractRDFListContractTests.NS + "c"),
-				model.createResource(AbstractRDFListContractTests.NS + "d"),
-				model.createResource(AbstractRDFListContractTests.NS + "e"), };
+				model.createResource(RDFListContractTests.NS + "a"),
+				model.createResource(RDFListContractTests.NS + "b"),
+				model.createResource(RDFListContractTests.NS + "c"),
+				model.createResource(RDFListContractTests.NS + "d"),
+				model.createResource(RDFListContractTests.NS + "e"), };
 
 		final RDFList l1 = getListRoot(model);
 
 		// test normal gets
-		for (int i = 0; i < toGet.length; i++)
-		{
+		for (int i = 0; i < toGet.length; i++) {
 			Assert.assertEquals("list element " + i + " is not correct",
 					toGet[i], l1.get(i));
 		}
 
 		// now test we get an exception for going beyong the end of the list
 		boolean gotEx = false;
-		try
-		{
+		try {
 			l1.get(toGet.length + 1);
-		}
-		catch (final ListIndexException e)
-		{
+		} catch (final ListIndexException e) {
 			gotEx = true;
 		}
 
@@ -580,32 +532,29 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testMap1()
-	{
+	public void testMap1() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final RDFList root = getListRoot(model);
-		AbstractRDFListContractTests.iteratorTest(root.mapWith(new Map1<RDFNode, String>() {
-			@Override
-			public String map1( final RDFNode x )
-			{
-				return ((Resource) x).getLocalName();
-			}
-		}), new Object[] { "a", "b", "c", "d", "e" });
+		RDFListContractTests.iteratorTest(
+				root.mapWith(new Map1<RDFNode, String>() {
+					@Override
+					public String map1(final RDFNode x) {
+						return ((Resource) x).getLocalName();
+					}
+				}), new Object[] { "a", "b", "c", "d", "e" });
 
 	}
 
 	@Test
-	public void testReduce()
-	{
+	public void testReduce() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final RDFList root = getListRoot(model);
 
 		final RDFList.ReduceFn f = new RDFList.ReduceFn() {
 			@Override
-			public Object reduce( final RDFNode n, final Object acc )
-			{
+			public Object reduce(final RDFNode n, final Object acc) {
 				return ((String) acc) + ((Resource) n).getLocalName();
 			}
 		};
@@ -616,26 +565,23 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testRemove()
-	{
+	public void testRemove() {
 
 		final Resource nil = model.getResource(RDF.nil.getURI());
 		RDFList list0 = nil.as(RDFList.class);
 		RDFList list1 = nil.as(RDFList.class);
 
-		final Resource r0 = model.createResource(AbstractRDFListContractTests.NS + "x");
-		final Resource r1 = model.createResource(AbstractRDFListContractTests.NS + "y");
-		final Resource r2 = model.createResource(AbstractRDFListContractTests.NS + "z");
+		final Resource r0 = model.createResource(RDFListContractTests.NS + "x");
+		final Resource r1 = model.createResource(RDFListContractTests.NS + "y");
+		final Resource r2 = model.createResource(RDFListContractTests.NS + "z");
 
-		for (int i = 0; i < 10; i++)
-		{
+		for (int i = 0; i < 10; i++) {
 			list0 = list0.cons(r0);
 			list1 = list1.cons(r1);
 		}
 
 		// delete the elements of list0 one at a time
-		while (!list0.isEmpty())
-		{
+		while (!list0.isEmpty()) {
 			list0 = list0.removeHead();
 			checkValid("removeTest0", list0, true);
 		}
@@ -672,8 +618,7 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testReplace()
-	{
+	public void testReplace() {
 		model.read(getFileName("ontology/list5.rdf"));
 
 		final Literal[] toSet = new Literal[] { model.createLiteral("a"),
@@ -683,26 +628,21 @@ AbstractModelProducerUser  {
 		final RDFList l1 = getListRoot(model);
 
 		// change all the values
-		for (int i = 0; i < toSet.length; i++)
-		{
+		for (int i = 0; i < toSet.length; i++) {
 			l1.replace(i, toSet[i]);
 		}
 
 		// then check them
-		for (int i = 0; i < toSet.length; i++)
-		{
+		for (int i = 0; i < toSet.length; i++) {
 			Assert.assertEquals("list element " + i + " is not correct",
 					toSet[i], l1.get(i));
 		}
 
 		// now test we get an exception for going beyong the end of the list
 		boolean gotEx = false;
-		try
-		{
+		try {
 			l1.replace(toSet.length + 1, toSet[0]);
-		}
-		catch (final ListIndexException e)
-		{
+		} catch (final ListIndexException e) {
 			gotEx = true;
 		}
 
@@ -713,11 +653,11 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testSetHead()
-	{
+	public void testSetHead() {
 
-		final Resource root = model.createResource(AbstractRDFListContractTests.NS + "root");
-		final Property p = model.createProperty(AbstractRDFListContractTests.NS, "p");
+		final Resource root = model.createResource(RDFListContractTests.NS
+				+ "root");
+		final Property p = model.createProperty(RDFListContractTests.NS, "p");
 
 		// a list of the nil object, but not typed
 		final Resource nil = RDF.nil;
@@ -743,12 +683,12 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testSetTail()
-	{
+	public void testSetTail() {
 		final Model m = ModelFactory.createDefaultModel();
 
-		final Resource root = m.createResource(AbstractRDFListContractTests.NS + "root");
-		final Property p = m.createProperty(AbstractRDFListContractTests.NS, "p");
+		final Resource root = m
+				.createResource(RDFListContractTests.NS + "root");
+		final Property p = m.createProperty(RDFListContractTests.NS, "p");
 
 		final Resource nil = RDF.nil;
 		m.add(nil, RDF.type, RDF.List);
@@ -786,17 +726,14 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testTail()
-	{
-		for (int i = 0; i <= 5; i++)
-		{
-			model.read( getFileName("ontology/list" + i + ".rdf"));
+	public void testTail() {
+		for (int i = 0; i <= 5; i++) {
+			model.read(getFileName("ontology/list" + i + ".rdf"));
 
 			RDFList l0 = getListRoot(model);
 
 			// get the tail n times, should be nil at the end
-			for (int j = 0; j < i; j++)
-			{
+			for (int j = 0; j < i; j++) {
 				l0 = l0.getTail();
 			}
 
@@ -806,11 +743,11 @@ AbstractModelProducerUser  {
 	}
 
 	@Test
-	public void testValidity()
-	{
+	public void testValidity() {
 
-		final Resource root = model.createResource(AbstractRDFListContractTests.NS + "root");
-		final Property p = model.createProperty(AbstractRDFListContractTests.NS, "p");
+		final Resource root = model.createResource(RDFListContractTests.NS
+				+ "root");
+		final Property p = model.createProperty(RDFListContractTests.NS, "p");
 
 		// a list of the nil object, but not typed
 		final Resource nil = RDF.nil;
@@ -837,8 +774,6 @@ AbstractModelProducerUser  {
 
 	}
 
-	
-
 	// public void testListSubclass() {
 	// String NS = "http://example.org/test#";
 	// Resource a = model.createResource( NS + "a" );

Copied: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFNodeContractTests.java (from r1525417, jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFNodeContractTests.java)
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFNodeContractTests.java?p2=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFNodeContractTests.java&p1=jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFNodeContractTests.java&r1=1525417&r2=1530718&rev=1530718&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/AbstractRDFNodeContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFNodeContractTests.java Wed Oct  9 17:16:15 2013
@@ -27,7 +27,7 @@ import com.hp.hpl.jena.rdf.model.RDFVisi
 import com.hp.hpl.jena.rdf.model.Resource;
 import com.hp.hpl.jena.rdf.model.ResourceRequiredException;
 
-import com.hp.hpl.jena.testing_framework.NodeProducerInterface;
+import com.hp.hpl.jena.testing_framework.INodeProducer;
 
 import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
 
@@ -36,96 +36,147 @@ import java.util.List;
 
 import static org.junit.Assert.*;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.xenei.junit.contract.Contract;
 
 /**
  * This class tests various properties of RDFNodes.
  */
-public abstract class AbstractRDFNodeContractTests {
+@Contract(RDFNode.class)
+public abstract class RDFNodeContractTests {
+
+	@Contract.Inject("com.hp.hpl.jena.testing_framework.INodeProducer<%s>")
+	public abstract INodeProducer<RDFNode> getNodeProducer();
 
-	protected abstract NodeProducerInterface getNodeProducer();
-	
 	protected RDFNode node;
 	protected Model model;
-	
+
 	@Before
-	public final void setupAbstractRDFNodeContractTests() 
-	{
-		node = getNodeProducer().newRDFNode();
+	public final void beforeRDFNodeContractTests() {
+		node = getNodeProducer().newInstance();
 		model = node.getModel();
 	}
-	
+
+	@After
+	public final void afterRDFNodeContractTests() {
+		getNodeProducer().cleanUp();
+	}
+
 	@Test
 	public void testAsLiteral() {
-		RDFNode node = model.createLiteral( "foo");
-		assertSame( node, node.asLiteral());
+		RDFNode node = model.createLiteral("foo");
+		assertSame(node, node.asLiteral());
 		node = model.createResource();
 		try {
 			node.asLiteral();
 			fail("should have thrown Exception");
-		} catch (LiteralRequiredException expected)
-		{
+		} catch (LiteralRequiredException expected) {
 			// expected
 		}
 	}
-	
+
 	@Test
 	public void testAsResource() {
 		node = model.createResource();
 		Resource r = node.asResource();
-		assertSame( r, node );
-		node = model.createLiteral( "foo");
+		assertSame(r, node);
+		node = model.createLiteral("foo");
 		try {
-		 node.asResource();
-		fail("should have thrown Exception");
-		} catch (ResourceRequiredException expected)
-		{
+			node.asResource();
+			fail("should have thrown Exception");
+		} catch (ResourceRequiredException expected) {
 			// expected
 		}
 	}
-	
+
 	@Test
 	public void testGetModel() {
 		// all the other tests will be in model.crete(x) tests.
-		assertNotNull( model );
+		assertNotNull(model);
 	}
-	
+
 	@Test
 	public void testInModel_Model() {
-		
+
 		final Model m1 = model;
-		final Model m2 = getNodeProducer().newRDFNode().getModel();
-		final Resource r1 = m1.createResource( resource("r1").getURI() );
-		final Resource a1 = m1.createResource( resource("_r2").getId() );
+		final Model m2 = getNodeProducer().newInstance().getModel();
+		final Resource r1 = m1.createResource(resource("r1").getURI());
+		final Resource a1 = m1.createResource(resource("_r2").getId());
 		Resource r2 = null;
 		Resource a2 = null;
-		
+
 		/* verify initial conditions */
 		assertSame(r1.getModel(), m1);
 		assertSame(a1.getModel(), m1);
 		assertFalse(r1.isAnon());
 		assertTrue(a1.isAnon());
-		
+
 		/* verify calling inModel with same model returns resource */
 		r2 = r1.inModel(m1);
 		a2 = a1.inModel(m1);
-		assertSame( r2, r1);
-		assertSame( a2, a1);
-		
-		/* verify calling in model changes model*/
+		assertSame(r2, r1);
+		assertSame(a2, a1);
+
+		/* verify calling in model changes model */
 		r2 = r1.inModel(m2);
 		a2 = a1.inModel(m2);
-		
+
 		assertSame(r2.getModel(), m2);
 		assertSame(a2.getModel(), m2);
-		
-		/* verify in model check returns equivalent resource*/
+
+		/* verify in model check returns equivalent resource */
 		assertFalse(r2.isAnon());
 		assertTrue(a2.isAnon());
-		assertFalse( "Should not be the same", r1==r2 );
-		assertFalse( "Should not be the same", a1==a2 );
-		
+		assertSame("Should not be the same", r1, r2);
+		assertSame("Should not be the same", a1, a2);
+
+		assertEquals(r1, r2);
+		assertEquals(a1, a2);
+
+	}
+
+	@Test
+	public void testInModel_Model_InModel() {
+
+		final Model m1 = model;
+		final Model m2 = getNodeProducer().newInstance().getModel();
+		final Resource r1 = m1.createResource(resource("r1").getURI());
+		final Resource a1 = m1.createResource(resource("_r2").getId());
+		Statement stmt = m1.createStatement(r1, property("p"), resource("o"));
+		m1.add(stmt);
+		stmt = m1.createStatement(a1, property("p"), resource("o"));
+		m1.add(stmt);
+
+		Resource r2 = null;
+		Resource a2 = null;
+
+		/* verify initial conditions */
+		assertSame(r1.getModel(), m1);
+		assertSame(a1.getModel(), m1);
+		assertFalse(r1.isAnon());
+		assertTrue(a1.isAnon());
+
+		/* verify calling inModel with same model returns resource */
+		r2 = r1.inModel(m1);
+		a2 = a1.inModel(m1);
+		assertSame(r2, r1);
+		assertSame(a2, a1);
+
+		/* verify calling in model changes model */
+		r2 = r1.inModel(m2);
+		a2 = a1.inModel(m2);
+
+		assertSame(r2.getModel(), m2);
+		assertSame(a2.getModel(), m2);
+
+		/* verify in model check returns equivalent resource */
+		assertFalse(r2.isAnon());
+		assertTrue(a2.isAnon());
+		assertSame("Should not be the same", r1, r2);
+		assertSame("Should not be the same", a1, a2);
+
 		assertEquals(r1, r2);
 		assertEquals(a1, a2);
 
@@ -160,11 +211,9 @@ public abstract class AbstractRDFNodeCon
 		assertEquals(true, model.createResource("eh:/foo").isURIResource());
 		assertEquals(false, model.createResource().isURIResource());
 		assertEquals(false, model.createTypedLiteral(17).isURIResource());
-		assertEquals(false, model.createTypedLiteral("hello")
-				.isURIResource());
+		assertEquals(false, model.createTypedLiteral("hello").isURIResource());
 	}
 
-
 	@Test
 	public void testRDFVisitor() {
 		final List<String> history = new ArrayList<String>();
@@ -200,7 +249,6 @@ public abstract class AbstractRDFNodeCon
 		assertEquals("blank result", S.visitWith(rv));
 		assertEquals("uri result", P.visitWith(rv));
 		assertEquals("literal result", O.visitWith(rv));
-		assertEquals(listOfStrings("blank uri literal"),
-				history);
-	}	
+		assertEquals(listOfStrings("blank uri literal"), history);
+	}
 }



Mime
View raw message