You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by cl...@apache.org on 2014/01/05 12:28:05 UTC
svn commit: r1555482 [5/6] - in /jena/Experimental/new-test: ./
src/test/java/ 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/...
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/PropertyContractTest.java Sun Jan 5 11:28:03 2014
@@ -24,11 +24,9 @@ import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS;
import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
-@Ignore
@Contract(Property.class)
public class PropertyContractTest<T extends Property> {
@@ -47,7 +45,7 @@ public class PropertyContractTest<T exte
// return new PropertyImpl(uri);
// }
- @Test
+ @ContractTest
public void testNonOrdinalRDFURIs() {
testRDFOrdinalValue(0, "x");
testRDFOrdinalValue(0, "x1");
@@ -57,7 +55,7 @@ public class PropertyContractTest<T exte
testRDFOrdinalValue(0, "_xff");
}
- @Test
+ @ContractTest
public void testNonRDFElementURIsHaveOrdinal0() {
testOrdinalValue(0, "foo:bar");
testOrdinalValue(0, "foo:bar1");
@@ -72,7 +70,7 @@ public class PropertyContractTest<T exte
.getOrdinal());
}
- @Test
+ @ContractTest
public void testOrdinalValues() {
testRDFOrdinalValue(1, "_1");
testRDFOrdinalValue(2, "_2");
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFListContractTests.java Sun Jan 5 11:28:03 2014
@@ -28,7 +28,6 @@ import static com.hp.hpl.jena.testing_fr
import com.hp.hpl.jena.rdf.model.ListIndexException;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFList;
import com.hp.hpl.jena.rdf.model.RDFNode;
@@ -47,12 +46,10 @@ import java.util.List;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
/**
* <p>
@@ -62,7 +59,6 @@ import org.xenei.junit.contract.Contract
*
*
*/
-@Ignore
@Contract(RDFList.class)
public class RDFListContractTests<T extends RDFList> {
@@ -183,11 +179,10 @@ public class RDFListContractTests<T exte
return l;
}
- @Test
+ @ContractTest
public void testAdd() throws Exception {
- final Resource root = model.createResource(TestFileData.NS
- + "root");
+ final Resource root = model.createResource(TestFileData.NS + "root");
final Property p = model.createProperty(TestFileData.NS, "p");
final Resource nil = model.getResource(RDF.nil.getURI());
@@ -212,10 +207,10 @@ public class RDFListContractTests<T exte
}
// relate the root to the list
- txnBegin( model );
+ txnBegin(model);
model.add(root, p, list);
- txnCommit( model );
-
+ txnCommit(model);
+
// should be isomorphic with list 5
final Model m0 = TestFileData.getRDFModel("OntologyList5");
@@ -224,18 +219,17 @@ public class RDFListContractTests<T exte
}
- @Test
+ @ContractTest
public void testAppend() throws Exception {
- TestFileData.populateRDFModel( model, "OntologyList5");
+ TestFileData.populateRDFModel(model, "OntologyList5");
final Resource nil = model.getResource(RDF.nil.getURI());
RDFList list = nil.as(RDFList.class);
- final Resource r = model
- .createResource(TestFileData.NS + "foo");
+ final Resource r = model.createResource(TestFileData.NS + "foo");
// create a list of foos
- txnBegin( model );
+ txnBegin(model);
for (int i = 0; i < 5; i++) {
list = list.cons(r);
}
@@ -248,8 +242,8 @@ public class RDFListContractTests<T exte
final RDFList appended = root.append(list);
- txnCommit( model );
-
+ txnCommit(model);
+
// original list should be unchanged
checkValid("appendTest0", root, true);
Assert.assertEquals("Original list should be unchanged", rootLen,
@@ -265,9 +259,9 @@ public class RDFListContractTests<T exte
+ listLen, appended.size());
}
- @Test
+ @ContractTest
public void testApply() throws Exception {
- TestFileData.populateRDFModel( model, "OntologyList5");
+ TestFileData.populateRDFModel(model, "OntologyList5");
final RDFList root = getListRoot(model);
@@ -289,15 +283,14 @@ public class RDFListContractTests<T exte
}
- @Test
+ @ContractTest
public void testConcatenate() throws Exception {
- TestFileData.populateRDFModel( model, "OntologyList5");
+ TestFileData.populateRDFModel(model, "OntologyList5");
final Resource nil = model.getResource(RDF.nil.getURI());
RDFList list = nil.as(RDFList.class);
- final Resource r = model
- .createResource(TestFileData.NS + "foo");
+ final Resource r = model.createResource(TestFileData.NS + "foo");
// create a list of foos
for (int i = 0; i < 5; i++) {
@@ -322,9 +315,9 @@ public class RDFListContractTests<T exte
rootLen + listLen, root.size());
}
- @Test
+ @ContractTest
public void testConcatenate2() throws Exception {
- TestFileData.populateRDFModel( model, "OntologyList5");
+ TestFileData.populateRDFModel(model, "OntologyList5");
final Resource a = model.createResource(TestFileData.NS + "a");
@@ -347,13 +340,11 @@ public class RDFListContractTests<T exte
aList.sameListAs(root));
}
- @Test
+ @ContractTest
public void testCons() throws IOException {
- final Resource root = model.createResource(TestFileData.NS
- + "root");
+ final Resource root = model.createResource(TestFileData.NS + "root");
final Property p = model.createProperty(TestFileData.NS, "p");
-
RDFList list = producer.newInstance();
final Resource[] toAdd = new Resource[] {
@@ -363,7 +354,7 @@ public class RDFListContractTests<T exte
model.createResource(TestFileData.NS + "b"),
model.createResource(TestFileData.NS + "a"), };
- txnBegin( model );
+ txnBegin(model);
// cons each of these resources onto the front of the list
for (final Resource element : toAdd) {
final RDFList list0 = list.cons(element);
@@ -374,12 +365,11 @@ public class RDFListContractTests<T exte
list = list0;
}
-
// relate the root to the list
model.add(root, p, list);
- txnCommit( model );
-
+ txnCommit(model);
+
// should be isomorphic with list 5
final Model m0 = TestFileData.getRDFModel("OntologyList5");
@@ -387,37 +377,37 @@ public class RDFListContractTests<T exte
m0.isIsomorphicWith(model));
}
- @Test
+ @ContractTest
public void testCount() throws Exception {
for (int i = 0; i <= 5; i++) {
- txnBegin( model );
+ txnBegin(model);
model.removeAll();
- model.read(TestFileData.getRDFInput(String.format("OntologyList%s", i)), "http://example.com/test/");
- txnCommit( model );
+ model.read(TestFileData.getRDFInput(String.format("OntologyList%s",
+ i)), "http://example.com/test/");
+ txnCommit(model);
final RDFList l0 = getListRoot(model);
Assert.assertEquals("List size should be " + i, i, l0.size());
}
}
- @Test
+ @ContractTest
public void testHead() throws IOException {
- TestFileData.populateRDFModel( model, "OntologyList5" );
+ TestFileData.populateRDFModel(model, "OntologyList5");
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",
- TestFileData.NS + name,
- ((Resource) l0.getHead()).getURI());
+ TestFileData.NS + name, ((Resource) l0.getHead()).getURI());
l0 = l0.getTail();
}
}
- @Test
+ @ContractTest
public void testIndex1() throws IOException {
- TestFileData.populateRDFModel( model, "OntologyList5" );
+ TestFileData.populateRDFModel(model, "OntologyList5");
final Resource[] toGet = new Resource[] {
model.createResource(TestFileData.NS + "a"),
@@ -437,7 +427,7 @@ public class RDFListContractTests<T exte
}
}
- @Test
+ @ContractTest
public void testIndex2() {
RDFList list = producer.newInstance();
@@ -445,12 +435,12 @@ public class RDFListContractTests<T exte
final Resource r = model.createResource(TestFileData.NS + "a");
// cons each a's onto the front of the list
- txnBegin( model );
+ txnBegin(model);
for (int i = 0; i < 10; i++) {
list = list.cons(r);
}
- txnCommit( model );
-
+ txnCommit(model);
+
// now index them back again
for (int j = 0; j < 10; j++) {
Assert.assertEquals("index of j'th item should be j", j,
@@ -459,7 +449,7 @@ public class RDFListContractTests<T exte
}
- @Test
+ @ContractTest
public void testListEquals() {
final RDFList nilList = producer.newInstance();
@@ -479,7 +469,7 @@ public class RDFListContractTests<T exte
model.createResource(TestFileData.NS + "e") };
final Resource[] r2 = new Resource[] {
model.createResource(TestFileData.NS + "a"), // one
- // shorter
+ // shorter
model.createResource(TestFileData.NS + "b"),
model.createResource(TestFileData.NS + "c"),
model.createResource(TestFileData.NS + "d") };
@@ -505,12 +495,12 @@ public class RDFListContractTests<T exte
{ r2, r3, Boolean.FALSE }, { r2, r4, Boolean.FALSE }, };
for (int i = 0; i < testSpec.length; i++) {
- txnBegin( model );
+ txnBegin(model);
final RDFList l0 = nilList.append(Arrays.asList(
(Resource[]) testSpec[i][0]).iterator());
final RDFList l1 = nilList.append(Arrays.asList(
(Resource[]) testSpec[i][1]).iterator());
- txnCommit( model );
+ txnCommit(model);
final boolean expected = ((Boolean) testSpec[i][2]).booleanValue();
Assert.assertEquals("sameListAs testSpec[" + i + "] incorrect",
@@ -520,10 +510,10 @@ public class RDFListContractTests<T exte
}
}
- @Test
+ @ContractTest
public void testListGet() throws IOException {
- TestFileData.populateRDFModel( model, "OntologyList5" );
-
+ TestFileData.populateRDFModel(model, "OntologyList5");
+
final Resource[] toGet = new Resource[] {
model.createResource(TestFileData.NS + "a"),
model.createResource(TestFileData.NS + "b"),
@@ -552,9 +542,9 @@ public class RDFListContractTests<T exte
gotEx);
}
- @Test
+ @ContractTest
public void testMap1() throws IOException {
- TestFileData.populateRDFModel( model, "OntologyList5" );
+ TestFileData.populateRDFModel(model, "OntologyList5");
final RDFList root = getListRoot(model);
RDFListContractTests.iteratorTest(
@@ -567,9 +557,9 @@ public class RDFListContractTests<T exte
}
- @Test
+ @ContractTest
public void testReduce() throws IOException {
- TestFileData.populateRDFModel( model, "OntologyList5" );
+ TestFileData.populateRDFModel(model, "OntologyList5");
final RDFList root = getListRoot(model);
@@ -585,7 +575,7 @@ public class RDFListContractTests<T exte
"abcde", root.reduce(f, ""));
}
- @Test
+ @ContractTest
public void testRemove() {
final Resource nil = model.getResource(RDF.nil.getURI());
@@ -596,12 +586,12 @@ public class RDFListContractTests<T exte
final Resource r1 = model.createResource(TestFileData.NS + "y");
final Resource r2 = model.createResource(TestFileData.NS + "z");
- txnBegin( model );
+ txnBegin(model);
for (int i = 0; i < 10; i++) {
list0 = list0.cons(r0);
list1 = list1.cons(r1);
}
- txnCommit( model );
+ txnCommit(model);
// delete the elements of list0 one at a time
while (!list0.isEmpty()) {
@@ -610,49 +600,49 @@ public class RDFListContractTests<T exte
}
// delete all of list1 in one go
- txnBegin( model );
+ txnBegin(model);
list1.removeList();
- txnCommit( model );
+ txnCommit(model);
// model should now be empty
Assert.assertEquals("Model should be empty after deleting two lists",
0, model.size());
// selective remove
- txnBegin( model );
+ txnBegin(model);
RDFList list2 = (nil.as(RDFList.class)).cons(r2).cons(r1).cons(r0);
- txnCommit( model );
-
+ txnCommit(model);
+
Assert.assertTrue("list should contain x ", list2.contains(r0));
Assert.assertTrue("list should contain y ", list2.contains(r1));
Assert.assertTrue("list should contain z ", list2.contains(r2));
- txnBegin( model );
+ txnBegin(model);
list2 = list2.remove(r1);
- txnCommit( model );
+ txnCommit(model);
Assert.assertTrue("list should contain x ", list2.contains(r0));
Assert.assertTrue("list should contain y ", !list2.contains(r1));
Assert.assertTrue("list should contain z ", list2.contains(r2));
- txnBegin( model );
+ txnBegin(model);
list2 = list2.remove(r0);
- txnCommit( model );
+ txnCommit(model);
Assert.assertTrue("list should contain x ", !list2.contains(r0));
Assert.assertTrue("list should contain y ", !list2.contains(r1));
Assert.assertTrue("list should contain z ", list2.contains(r2));
- txnBegin( model );
+ txnBegin(model);
list2 = list2.remove(r2);
- txnCommit( model );
+ txnCommit(model);
Assert.assertTrue("list should contain x ", !list2.contains(r0));
Assert.assertTrue("list should contain y ", !list2.contains(r1));
Assert.assertTrue("list should contain z ", !list2.contains(r2));
Assert.assertTrue("list should be empty", list2.isEmpty());
}
- @Test
+ @ContractTest
public void testReplace() throws IOException {
- TestFileData.populateRDFModel( model, "OntologyList5" );
+ TestFileData.populateRDFModel(model, "OntologyList5");
final Literal[] toSet = new Literal[] { model.createLiteral("a"),
model.createLiteral("b"), model.createLiteral("c"),
@@ -660,13 +650,13 @@ public class RDFListContractTests<T exte
final RDFList l1 = getListRoot(model);
- txnBegin( model );
+ txnBegin(model);
// change all the values
for (int i = 0; i < toSet.length; i++) {
l1.replace(i, toSet[i]);
}
- txnCommit( model );
-
+ txnCommit(model);
+
// then check them
for (int i = 0; i < toSet.length; i++) {
Assert.assertEquals("list element " + i + " is not correct",
@@ -687,14 +677,13 @@ public class RDFListContractTests<T exte
}
- @Test
+ @ContractTest
public void testSetHead() {
- final Resource root = model.createResource(TestFileData.NS
- + "root");
+ final Resource root = model.createResource(TestFileData.NS + "root");
final Property p = model.createProperty(TestFileData.NS, "p");
- txnBegin( model );
+ txnBegin(model);
// a list of the nil object, but not typed
final Resource nil = RDF.nil;
model.add(nil, RDF.type, RDF.List);
@@ -705,31 +694,30 @@ public class RDFListContractTests<T exte
model.add(list, RDF.rest, nil);
model.add(root, p, list);
- txnCommit( model );
-
+ txnCommit(model);
+
final RDFList l1 = getListRoot(model);
checkValid("sethead1", l1, true);
Assert.assertEquals("List head should be 'fred'", "fred",
((Literal) l1.getHead()).getString());
- txnBegin( model );
+ txnBegin(model);
l1.setHead(model.createTypedLiteral(42));
- txnCommit( model );
-
+ txnCommit(model);
+
checkValid("sethead2", l1, true);
Assert.assertEquals("List head should be '42'", 42,
((Literal) l1.getHead()).getInt());
}
- @Test
+ @ContractTest
public void testSetTail() {
- final Resource root = model
- .createResource(TestFileData.NS + "root");
+ final Resource root = model.createResource(TestFileData.NS + "root");
final Property p = model.createProperty(TestFileData.NS, "p");
- txnBegin( model );
+ txnBegin(model);
final Resource nil = RDF.nil;
model.add(nil, RDF.type, RDF.List);
@@ -739,17 +727,17 @@ public class RDFListContractTests<T exte
model.add(list0, RDF.rest, nil);
model.add(root, p, list0);
- txnCommit( model );
-
+ txnCommit(model);
+
final RDFList l1 = getListRoot(model);
checkValid("settail1", l1, true);
final Resource list1 = model.createResource();
- txnBegin( model );
+ txnBegin(model);
model.add(list1, RDF.type, RDF.List);
model.add(list1, RDF.first, "george");
model.add(list1, RDF.rest, nil);
- txnCommit( model );
+ txnCommit(model);
final RDFList l2 = list1.as(RDFList.class);
Assert.assertNotNull("as(RDFList) should not return null for root", l2);
@@ -759,9 +747,9 @@ public class RDFListContractTests<T exte
Assert.assertEquals("l2 should have length 1", 1, l2.size());
// use set tail to join the lists together
- txnBegin( model );
+ txnBegin(model);
l1.setTail(l2);
- txnCommit( model );
+ txnCommit(model);
checkValid("settail3", l1, true);
checkValid("settail4", l2, true);
@@ -770,12 +758,13 @@ public class RDFListContractTests<T exte
}
- @Test
+ @ContractTest
public void testTail() throws IOException {
for (int i = 0; i <= 5; i++) {
- txnBegin( model );
- model.read(TestFileData.getRDFInput("OntologyList" + i ), "http://example.com/test/");
- txnCommit( model );
+ txnBegin(model);
+ model.read(TestFileData.getRDFInput("OntologyList" + i),
+ "http://example.com/test/");
+ txnCommit(model);
RDFList l0 = getListRoot(model);
// get the tail n times, should be nil at the end
@@ -788,16 +777,15 @@ public class RDFListContractTests<T exte
}
}
- @Test
+ @ContractTest
public void testValidity() {
- final Resource root = model.createResource(TestFileData.NS
- + "root");
+ final Resource root = model.createResource(TestFileData.NS + "root");
final Property p = model.createProperty(TestFileData.NS, "p");
// a list of the nil object, but not typed
final Resource nil = RDF.nil;
- txnBegin( model );
+ txnBegin(model);
model.add(root, p, nil);
final RDFList l0 = getListRoot(model);
checkValid("valid1", l0, true);
@@ -807,19 +795,19 @@ public class RDFListContractTests<T exte
model.getRequiredProperty(root, p).remove();
model.add(root, p, badList);
model.add(badList, RDF.type, RDF.List);
- txnCommit( model );
+ txnCommit(model);
final RDFList l1 = getListRoot(model);
checkValid("valid2", l1, false);
// checkValid( "valid3", l1, false );
- txnBegin( model );
+ txnBegin(model);
model.add(badList, RDF.first, "fred");
- txnCommit( model );
+ txnCommit(model);
checkValid("valid4", l1, false);
- txnBegin( model );
+ txnBegin(model);
model.add(badList, RDF.rest, nil);
- txnCommit( model );
+ txnCommit(model);
checkValid("valid5", l1, true);
}
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFNodeContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFNodeContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFNodeContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFNodeContractTests.java Sun Jan 5 11:28:03 2014
@@ -38,14 +38,12 @@ import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
/**
* This class tests various properties of RDFNodes.
*/
-@Ignore
@Contract(RDFNode.class)
public class RDFNodeContractTests<T extends RDFNode> {
@@ -74,7 +72,7 @@ public class RDFNodeContractTests<T exte
getNodeProducer().cleanUp();
}
- @Test
+ @ContractTest
public void testAsLiteral() {
RDFNode node = model.createLiteral("foo");
assertSame(node, node.asLiteral());
@@ -87,7 +85,7 @@ public class RDFNodeContractTests<T exte
}
}
- @Test
+ @ContractTest
public void testAsResource() {
node = model.createResource();
Resource r = node.asResource();
@@ -101,13 +99,13 @@ public class RDFNodeContractTests<T exte
}
}
- @Test
+ @ContractTest
public void testGetModel() {
// all the other tests will be in model.crete(x) tests.
assertNotNull(model);
}
- @Test
+ @ContractTest
public void testInModel_Model() {
final Model m1 = model;
@@ -147,7 +145,7 @@ public class RDFNodeContractTests<T exte
}
- @Test
+ @ContractTest
public void testInModel_Model_InModel() {
final Model m1 = model;
@@ -192,7 +190,7 @@ public class RDFNodeContractTests<T exte
}
- @Test
+ @ContractTest
public void testIsAnon() {
assertEquals(false, model.createResource("eh:/foo").isAnon());
assertEquals(true, model.createResource().isAnon());
@@ -200,7 +198,7 @@ public class RDFNodeContractTests<T exte
assertEquals(false, model.createTypedLiteral("hello").isAnon());
}
- @Test
+ @ContractTest
public void testIsLiteral() {
assertEquals(false, model.createResource("eh:/foo").isLiteral());
assertEquals(false, model.createResource().isLiteral());
@@ -208,7 +206,7 @@ public class RDFNodeContractTests<T exte
assertEquals(true, model.createTypedLiteral("hello").isLiteral());
}
- @Test
+ @ContractTest
public void testIsResource() {
assertEquals(true, model.createResource("eh:/foo").isResource());
assertEquals(true, model.createResource().isResource());
@@ -216,7 +214,7 @@ public class RDFNodeContractTests<T exte
assertEquals(false, model.createTypedLiteral("hello").isResource());
}
- @Test
+ @ContractTest
public void testIsURIResource() {
assertEquals(true, model.createResource("eh:/foo").isURIResource());
assertEquals(false, model.createResource().isURIResource());
@@ -224,7 +222,7 @@ public class RDFNodeContractTests<T exte
assertEquals(false, model.createTypedLiteral("hello").isURIResource());
}
- @Test
+ @ContractTest
public void testRDFVisitor() {
final List<String> history = new ArrayList<String>();
final RDFNode S = model.createResource();
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFReaderFContractTests.java Sun Jan 5 11:28:03 2014
@@ -3,9 +3,8 @@ package com.hp.hpl.jena.rdf.model;
import java.io.InputStream;
import java.io.Reader;
-import org.junit.Ignore;
-import org.junit.Test;
import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
import com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl;
import com.hp.hpl.jena.shared.NoReaderForLangException;
@@ -17,17 +16,16 @@ import com.hp.hpl.jena.testing_framework
import static org.junit.Assert.*;
import static com.hp.hpl.jena.testing_framework.ModelHelper.*;
-@Ignore
@Contract(RDFReaderF.class)
public class RDFReaderFContractTests<T extends RDFReaderF> extends
- ContractTemplate<T> {
+ ContractTemplate<IProducer<T>> {
@Contract.Inject
public final void setRDFReaderFContractTestsProducer(IProducer<T> producer) {
setProducer(producer);
}
- @Test
+ @ContractTest
public void testGetReader() throws Exception {
RDFReader reader = getProducer().newInstance().getReader();
@@ -39,7 +37,7 @@ public class RDFReaderFContractTests<T e
txnCommit(model);
}
- @Test
+ @ContractTest
public void testGetReader_String() throws Exception {
/*
* RDF/XML - default RDF/XML-ABBREV N-TRIPLE N3
@@ -81,7 +79,7 @@ public class RDFReaderFContractTests<T e
}
- @Test
+ @ContractTest
public void testSetReaderClassName() throws Exception {
RDFReaderF readerF = getProducer().newInstance();
@@ -98,31 +96,29 @@ public class RDFReaderFContractTests<T e
readerF.resetRDFReaderF();
}
}
-
- @Test
+
+ @ContractTest
public void testResetRDFReaderF() throws Exception {
RDFReaderF readerF = getProducer().newInstance();
- String before = readerF.setReaderClassName("foo",
- DummyReader.class.getName());
+ String before = readerF.setReaderClassName("foo",
+ DummyReader.class.getName());
- assertNull("Should not be an existing name", before);
+ assertNull("Should not be an existing name", before);
+
+ RDFReader reader = readerF.getReader("foo");
+ assertEquals("Wrong reader type", DummyReader.class, reader.getClass());
+ readerF.resetRDFReaderF();
- RDFReader reader = readerF.getReader("foo");
- assertEquals("Wrong reader type", DummyReader.class,
- reader.getClass());
- readerF.resetRDFReaderF();
-
-
try {
readerF.getReader("foo");
- fail( "Should have thrown NoReaderForLangException");
- } catch( NoReaderForLangException expected ){
+ fail("Should have thrown NoReaderForLangException");
+ } catch (NoReaderForLangException expected) {
// expected
}
}
- @Test
+ @ContractTest
public void testRemoveReader_String_AfterInsert() throws Exception {
RDFReaderF readerF = getProducer().newInstance();
try {
@@ -134,32 +130,31 @@ public class RDFReaderFContractTests<T e
RDFReader reader = readerF.getReader("foo");
assertEquals("Wrong reader type", DummyReader.class,
reader.getClass());
-
- String after = readerF.removeReader( "foo" );
- String expectedName = RDFReaderFContractTests.class.getCanonicalName()+"$DummyReader";
- assertEquals( "Should return reader name", expectedName, after );
-
+
+ String after = readerF.removeReader("foo");
+ String expectedName = RDFReaderFContractTests.class
+ .getCanonicalName() + "$DummyReader";
+ assertEquals("Should return reader name", expectedName, after);
+
try {
readerF.getReader("foo");
- fail( "Should have thrown NoReaderForLangException");
- } catch( NoReaderForLangException expected ){
+ fail("Should have thrown NoReaderForLangException");
+ } catch (NoReaderForLangException expected) {
// expected
}
-
-
+
} finally {
readerF.resetRDFReaderF();
}
}
-
- @Test
- public void testGlobalNatureOfReaderRegistration()
- {
+
+ @ContractTest
+ public void testGlobalNatureOfReaderRegistration() {
// changes in one reader impact all readers.
RDFReaderF readerF = getProducer().newInstance();
RDFReaderF defaultF = new RDFReaderFImpl();
-
+
try {
String before = readerF.setReaderClassName("foo",
DummyReader.class.getName());
@@ -169,59 +164,57 @@ public class RDFReaderFContractTests<T e
RDFReader reader = readerF.getReader("foo");
assertEquals("Wrong reader type", DummyReader.class,
reader.getClass());
-
- reader = defaultF.getReader( "foo" );
- assertEquals("Default reader type was not set type", DummyReader.class,
- reader.getClass());
-
+
+ reader = defaultF.getReader("foo");
+ assertEquals("Default reader type was not set type",
+ DummyReader.class, reader.getClass());
+
} finally {
readerF.resetRDFReaderF();
}
try {
- readerF.getReader("foo");;
- fail( "Should have thrown NoReaderForLangException");
- } catch( NoReaderForLangException expected ){
+ readerF.getReader("foo");
+ ;
+ fail("Should have thrown NoReaderForLangException");
+ } catch (NoReaderForLangException expected) {
// expected
}
try {
- defaultF.getReader("foo");;
- fail( "Default should have thrown NoReaderForLangException");
- } catch( NoReaderForLangException expected ){
+ defaultF.getReader("foo");
+ ;
+ fail("Default should have thrown NoReaderForLangException");
+ } catch (NoReaderForLangException expected) {
// expected
}
-
+
}
-
- @Test
+
+ @ContractTest
public void testRemoveReader_String_requiredLang() throws Exception {
RDFReaderF readerF = getProducer().newInstance();
try {
try {
- readerF.getReader( "TURTLE");
- } catch( NoReaderForLangException expected ){
- fail( "Language 'TURTLE' does not have a reader");
+ readerF.getReader("TURTLE");
+ } catch (NoReaderForLangException expected) {
+ fail("Language 'TURTLE' does not have a reader");
}
try {
readerF.removeReader("TURTLE");
- fail( "Should have thrown an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
+ fail("Should have thrown an IllegalArgumentException");
+ } catch (IllegalArgumentException expected) {
// expected
}
try {
- readerF.getReader( "TURTLE");
- } catch( NoReaderForLangException e ){
- fail( "getReader should not have failed but TURTLE was removed");
+ readerF.getReader("TURTLE");
+ } catch (NoReaderForLangException e) {
+ fail("getReader should not have failed but TURTLE was removed");
}
- }
- finally {
+ } finally {
readerF.resetRDFReaderF();
}
}
-
public static class DummyReader implements RDFReader {
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/RDFWriterFContractTests.java Sun Jan 5 11:28:03 2014
@@ -4,9 +4,8 @@ import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.Writer;
-import org.junit.Ignore;
-import org.junit.Test;
import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
import com.hp.hpl.jena.rdf.model.impl.RDFWriterFImpl;
import com.hp.hpl.jena.shared.NoWriterForLangException;
@@ -16,10 +15,9 @@ import com.hp.hpl.jena.testing_framework
import com.hp.hpl.jena.testing_framework.TestFileData;
import static org.junit.Assert.*;
-@Ignore
@Contract(RDFWriterF.class)
public class RDFWriterFContractTests<T extends RDFWriterF> extends
- ContractTemplate<T> {
+ ContractTemplate<IProducer<T>> {
// known model to use for writing.
private Model model = ModelFactory.createModelForGraph(TestFileData
@@ -30,7 +28,7 @@ public class RDFWriterFContractTests<T e
super.setProducer(producer);
}
- @Test
+ @ContractTest
public void testGetWriter() throws Exception {
RDFWriter writer = getProducer().newInstance().getWriter();
@@ -39,7 +37,7 @@ public class RDFWriterFContractTests<T e
"http://example.com/base/");
}
- @Test
+ @ContractTest
public void testGetWriter_String() throws Exception {
/*
* RDF/XML - default RDF/XML-ABBREV N-TRIPLE N3
@@ -76,7 +74,7 @@ public class RDFWriterFContractTests<T e
}
}
- @Test
+ @ContractTest
public void testSetWriterClassName() throws Exception {
RDFWriterF writerF = getProducer().newInstance();
try {
@@ -95,30 +93,28 @@ public class RDFWriterFContractTests<T e
}
- @Test
+ @ContractTest
public void testResetRDFWriterF() throws Exception {
RDFWriterF writerF = getProducer().newInstance();
- String before = writerF.setWriterClassName("foo",
- DummyWriter.class.getName());
+ String before = writerF.setWriterClassName("foo",
+ DummyWriter.class.getName());
- assertNull("Should not be an existing name", before);
+ assertNull("Should not be an existing name", before);
+
+ RDFWriter writer = writerF.getWriter("foo");
+ assertEquals("Wrong writer type", DummyWriter.class, writer.getClass());
+ writerF.resetRDFWriterF();
- RDFWriter writer = writerF.getWriter("foo");
- assertEquals("Wrong writer type", DummyWriter.class,
- writer.getClass());
- writerF.resetRDFWriterF();
-
-
try {
writerF.getWriter("foo");
- fail( "Should have thrown NoWriterForLangException");
- } catch( NoWriterForLangException expected ){
+ fail("Should have thrown NoWriterForLangException");
+ } catch (NoWriterForLangException expected) {
// expected
}
}
- @Test
+ @ContractTest
public void testRemoveWriter_String_AfterInsert() throws Exception {
RDFWriterF writerF = getProducer().newInstance();
try {
@@ -130,32 +126,31 @@ public class RDFWriterFContractTests<T e
RDFWriter writer = writerF.getWriter("foo");
assertEquals("Wrong writer type", DummyWriter.class,
writer.getClass());
-
- String after = writerF.removeWriter( "foo" );
- String expectedName = RDFWriterFContractTests.class.getCanonicalName()+"$DummyWriter";
- assertEquals( "Should return writer name", expectedName, after );
-
+
+ String after = writerF.removeWriter("foo");
+ String expectedName = RDFWriterFContractTests.class
+ .getCanonicalName() + "$DummyWriter";
+ assertEquals("Should return writer name", expectedName, after);
+
try {
writerF.getWriter("foo");
- fail( "Should have thrown NoWriterForLangException");
- } catch( NoWriterForLangException expected ){
+ fail("Should have thrown NoWriterForLangException");
+ } catch (NoWriterForLangException expected) {
// expected
}
-
-
+
} finally {
writerF.resetRDFWriterF();
}
}
-
- @Test
- public void testGlobalNatureOfWriterRegistration()
- {
+
+ @ContractTest
+ public void testGlobalNatureOfWriterRegistration() {
// changes in one writer impact all writers.
RDFWriterF writerF = getProducer().newInstance();
RDFWriterF defaultF = new RDFWriterFImpl();
-
+
try {
String before = writerF.setWriterClassName("foo",
DummyWriter.class.getName());
@@ -165,59 +160,58 @@ public class RDFWriterFContractTests<T e
RDFWriter writer = writerF.getWriter("foo");
assertEquals("Wrong writer type", DummyWriter.class,
writer.getClass());
-
- writer = defaultF.getWriter( "foo" );
- assertEquals("Default writer type was not set type", DummyWriter.class,
- writer.getClass());
-
+
+ writer = defaultF.getWriter("foo");
+ assertEquals("Default writer type was not set type",
+ DummyWriter.class, writer.getClass());
+
} finally {
writerF.resetRDFWriterF();
}
try {
- writerF.getWriter("foo");;
- fail( "Should have thrown NoWriterForLangException");
- } catch( NoWriterForLangException expected ){
+ writerF.getWriter("foo");
+ ;
+ fail("Should have thrown NoWriterForLangException");
+ } catch (NoWriterForLangException expected) {
// expected
}
try {
- defaultF.getWriter("foo");;
- fail( "Default should have thrown NoWriterForLangException");
- } catch( NoWriterForLangException expected ){
+ defaultF.getWriter("foo");
+ ;
+ fail("Default should have thrown NoWriterForLangException");
+ } catch (NoWriterForLangException expected) {
// expected
}
-
+
}
-
- @Test
+
+ @ContractTest
public void testRemoveWriter_String_requiredLang() throws Exception {
RDFWriterF writerF = getProducer().newInstance();
try {
try {
- writerF.getWriter( "TURTLE");
- } catch( NoWriterForLangException expected ){
- fail( "Language 'TURTLE' does not have a writer");
+ writerF.getWriter("TURTLE");
+ } catch (NoWriterForLangException expected) {
+ fail("Language 'TURTLE' does not have a writer");
}
try {
writerF.removeWriter("TURTLE");
- fail( "Should have thrown an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
+ fail("Should have thrown an IllegalArgumentException");
+ } catch (IllegalArgumentException expected) {
// expected
}
try {
- writerF.getWriter( "TURTLE");
- } catch( NoWriterForLangException e ){
- fail( "getWriter should not have failed but TURTLE was removed");
+ writerF.getWriter("TURTLE");
+ } catch (NoWriterForLangException e) {
+ fail("getWriter should not have failed but TURTLE was removed");
}
- }
- finally {
+ } finally {
writerF.resetRDFWriterF();
}
}
-
+
// Class used to set a writer
public static class DummyWriter implements RDFWriter {
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ResourceContractTests.java Sun Jan 5 11:28:03 2014
@@ -43,14 +43,12 @@ import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
/**
* This class tests various properties of RDFNodes.
*/
-@Ignore
@Contract(Resource.class)
public class ResourceContractTests<T extends Resource> {
@@ -82,7 +80,7 @@ public class ResourceContractTests<T ext
getResourceProducer().cleanUp();
}
- @Test
+ @ContractTest
public void testRemoveAll_Property() {
final String ps = "x P a; x P b", rest = "x Q c; y P a; y Q b";
@@ -113,7 +111,7 @@ public class ResourceContractTests<T ext
.toList().size());
}
- @Test
+ @ContractTest
public void testAddLiteralPassesLiteralUnmodified() {
model.register(SL);
txnBegin(model);
@@ -125,7 +123,7 @@ public class ResourceContractTests<T ext
SL.assertHasStart("add", statement(r, RDF.value, lit));
}
- @Test
+ @ContractTest
public void testAddLiteral_Property_boolean() {
model.register(SL);
txnBegin(model);
@@ -137,7 +135,7 @@ public class ResourceContractTests<T ext
statement(r, RDF.value, model.createTypedLiteral(true)));
}
- @Test
+ @ContractTest
public void testAddLiteral_Property_char() {
model.register(SL);
txnBegin(model);
@@ -149,7 +147,7 @@ public class ResourceContractTests<T ext
statement(r, RDF.value, model.createTypedLiteral('x')));
}
- @Test
+ @ContractTest
public void testAddLiteral_Property_double() {
model.register(SL);
txnBegin(model);
@@ -161,7 +159,7 @@ public class ResourceContractTests<T ext
statement(r, RDF.value, model.createTypedLiteral(1.0d)));
}
- @Test
+ @ContractTest
public void testAddLiteral_Property_float() {
model.register(SL);
txnBegin(model);
@@ -173,7 +171,7 @@ public class ResourceContractTests<T ext
statement(r, RDF.value, model.createTypedLiteral(1.0f)));
}
- @Test
+ @ContractTest
public void testAddLiteral_Property_int() {
model.register(SL);
txnBegin(model);
@@ -189,7 +187,7 @@ public class ResourceContractTests<T ext
statement(r, RDF.value, model.createTypedLiteral(1L)));
}
- @Test
+ @ContractTest
public void testAddLiteral_Property_long() {
model.register(SL);
txnBegin(model);
@@ -201,7 +199,7 @@ public class ResourceContractTests<T ext
statement(r, RDF.value, model.createTypedLiteral(1L)));
}
- @Test
+ @ContractTest
public void testAddLiteral_Property_Object() {
final Object z = new Object();
model.register(SL);
@@ -214,7 +212,7 @@ public class ResourceContractTests<T ext
statement(r, RDF.value, model.createTypedLiteral(z)));
}
- @Test
+ @ContractTest
public void testAddLiteral_Property_String() {
model.register(SL);
txnBegin(model);
@@ -226,7 +224,7 @@ public class ResourceContractTests<T ext
statement(r, RDF.value, model.createTypedLiteral("foo")));
}
- @Test
+ @ContractTest
public void testBegin() {
if (model.supportsTransactions()) {
r.begin();
@@ -241,7 +239,7 @@ public class ResourceContractTests<T ext
}
}
- @Test
+ @ContractTest
public void testAbort() {
if (model.supportsTransactions()) {
assertEquals("Model is empty", 0, model.listStatements().toList()
@@ -261,7 +259,7 @@ public class ResourceContractTests<T ext
}
}
- @Test
+ @ContractTest
public void testCommit() {
if (model.supportsTransactions()) {
assertEquals("Model is empty", 0, model.listStatements().toList()
@@ -288,7 +286,7 @@ public class ResourceContractTests<T ext
* If one resource is anonymous and the other is not, then they are not
* equal.
*/
- @Test
+ @ContractTest
public void testEquals_Object() {
Resource r1 = model.createResource();
Resource r2 = model.createResource();
@@ -311,7 +309,7 @@ public class ResourceContractTests<T ext
assertNotEquals("anon and uri resource", r1, r2);
}
- @Test
+ @ContractTest
public void testGetId() {
AnonId id = AnonId.create("5");
r = model.createResource(id);
@@ -331,7 +329,7 @@ public class ResourceContractTests<T ext
}
}
- @Test
+ @ContractTest
public void testGetLocalName() {
// simple case
assertEquals("foo", model.createResource("http://example.com/foo")
@@ -371,7 +369,7 @@ public class ResourceContractTests<T ext
.getLocalName());
}
- @Test
+ @ContractTest
public void testGetNameSpace() {
// simple case
assertEquals("http://example.com/",
@@ -413,7 +411,7 @@ public class ResourceContractTests<T ext
}
- @Test
+ @ContractTest
public void testGetProperty_Property() {
txnBegin(model);
modelAdd(model, "x p 17; x P y");
@@ -431,7 +429,7 @@ public class ResourceContractTests<T ext
}
- @Test
+ @ContractTest
public void testGetPropertyResourceValue_Property() {
txnBegin(model);
modelAdd(model, "x p 17; x P y");
@@ -451,7 +449,7 @@ public class ResourceContractTests<T ext
assertEquals(resource("y"), r2);
}
- @Test
+ @ContractTest
public void testGetRequiredProperty_Property() {
txnBegin(model);
modelAdd(model, "x p 17; x P y");
@@ -471,7 +469,7 @@ public class ResourceContractTests<T ext
}
- @Test
+ @ContractTest
public void testGetURI() {
if (getResourceProducer().supportsAnonymous()) {
assertNull(r.getURI());
@@ -480,7 +478,7 @@ public class ResourceContractTests<T ext
model.createResource("http://example.com/foo").getURI());
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_boolean() {
txnBegin(model);
r.addLiteral(RDF.value, false);
@@ -490,7 +488,7 @@ public class ResourceContractTests<T ext
assertFalse(r.hasLiteral(RDF.value, true));
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_byte() {
byte b = "B".getBytes()[0];
byte b2 = "C".getBytes()[0];
@@ -502,7 +500,7 @@ public class ResourceContractTests<T ext
assertFalse(r.hasLiteral(RDF.value, b2));
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_short() {
short s = 5;
short s2 = 6;
@@ -514,7 +512,7 @@ public class ResourceContractTests<T ext
assertFalse(r.hasLiteral(RDF.value, s2));
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_char() {
txnBegin(model);
r.addLiteral(RDF.value, 'x');
@@ -524,7 +522,7 @@ public class ResourceContractTests<T ext
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_double() {
txnBegin(model);
r.addLiteral(RDF.value, 1.0d);
@@ -534,7 +532,7 @@ public class ResourceContractTests<T ext
assertFalse(r.hasLiteral(RDF.value, 1.0f));
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_float() {
txnBegin(model);
r.addLiteral(RDF.value, 1.0f);
@@ -544,7 +542,7 @@ public class ResourceContractTests<T ext
assertFalse(r.hasLiteral(RDF.value, 1.0d));
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_long() {
txnBegin(model);
r.addLiteral(RDF.value, 1L);
@@ -555,7 +553,7 @@ public class ResourceContractTests<T ext
r.hasLiteral(RDF.value, 1));
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_int() {
txnBegin(model);
r.addLiteral(RDF.value, 1);
@@ -566,7 +564,7 @@ public class ResourceContractTests<T ext
r.hasLiteral(RDF.value, 1L));
}
- @Test
+ @ContractTest
public void testHasLiteral_Property_Object() {
final Object z = new Object();
txnBegin(model);
@@ -576,7 +574,7 @@ public class ResourceContractTests<T ext
assertFalse(r.hasLiteral(RDF.value, new Object()));
}
- @Test
+ @ContractTest
public void testHasProperty_Property() {
final RDFNode rdf = rdfNode("http://example.com/rdf");
txnBegin(model);
@@ -587,7 +585,7 @@ public class ResourceContractTests<T ext
assertTrue(r.hasProperty(null));
}
- @Test
+ @ContractTest
public void testHasProperty_Property_RDFNode() {
final RDFNode rdf = rdfNode("http://example.com/rdf");
txnBegin(model);
@@ -601,7 +599,7 @@ public class ResourceContractTests<T ext
assertTrue(r.hasProperty(null, (RDFNode) null));
}
- @Test
+ @ContractTest
public void testHasProperty_Property_String() {
txnBegin(model);
r.addProperty(RDF.value, "foo");
@@ -617,7 +615,7 @@ public class ResourceContractTests<T ext
assertTrue(r.hasProperty(null, "foo"));
}
- @Test
+ @ContractTest
public void testHasProperty_Property_String_String() {
txnBegin(model);
r.addProperty(RDF.value, "foo", "fr");
@@ -638,7 +636,7 @@ public class ResourceContractTests<T ext
}
}
- @Test
+ @ContractTest
public void testHasURI() {
r = model.createResource();
assertFalse(model.createResource().hasURI("http://example.com/foo"));
@@ -650,7 +648,7 @@ public class ResourceContractTests<T ext
"http://example.com/foo"));
}
- @Test
+ @ContractTest
public void testlistProperties() {
Property[] props = { property("P"), property("Q"), property("R"),
property("S") };
@@ -681,7 +679,7 @@ public class ResourceContractTests<T ext
}
}
- @Test
+ @ContractTest
public void testlistProperties_Property() {
txnBegin(model);
r.addLiteral(property("P"), "foo");
@@ -711,7 +709,7 @@ public class ResourceContractTests<T ext
}
- @Test
+ @ContractTest
public void testRemoveProperties() {
txnBegin(model);
r.addLiteral(property("P"), "foo");
@@ -745,7 +743,7 @@ public class ResourceContractTests<T ext
.listStatements().toList().size());
}
- @Test
+ @ContractTest
public void testInModel() {
Model m = memModel("");
assertEquals(model, r.getModel());
@@ -757,7 +755,7 @@ public class ResourceContractTests<T ext
/**
* Test that a non-literal node cannot be as'ed into a literal
*/
- @Test
+ @ContractTest
public void testAs_Literal_fails() {
try {
r.as(Literal.class);
@@ -770,7 +768,7 @@ public class ResourceContractTests<T ext
/**
* Test that the simple reification results in a reified statement
*/
- @Test
+ @ContractTest
public void testAsReifiedStatement() {
final Resource R = model.createResource();
final Resource S = model.createResource("http://example.com/subject");
@@ -790,7 +788,7 @@ public class ResourceContractTests<T ext
//
//
- // @Test
+ // @ContractTest
// public void testLiteral()throws Exception
// {
// Model model = getModelProducer().newModel();
@@ -804,7 +802,7 @@ public class ResourceContractTests<T ext
//
//
//
- // @Test
+ // @ContractTest
// public void testShort()throws Exception
// {
// Model model = getModelProducer().newModel();
@@ -813,7 +811,7 @@ public class ResourceContractTests<T ext
// .hasLiteral(RDF.value, tvShort));
// }
//
- // @Test
+ // @ContractTest
// public void testString()throws Exception
// {
// Model model = getModelProducer().newModel();
@@ -822,7 +820,7 @@ public class ResourceContractTests<T ext
// tvString));
// }
//
- // @Test
+ // @ContractTest
// public void testStringWithLanguage()throws Exception
// {
// Model model = getModelProducer().newModel();
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/SeqContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/SeqContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/SeqContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/SeqContractTests.java Sun Jan 5 11:28:03 2014
@@ -38,11 +38,9 @@ import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
-@Ignore
@Contract(Seq.class)
public class SeqContractTests<T extends Seq> {
@@ -100,7 +98,7 @@ public class SeqContractTests<T extends
tvSeq = getSeqProducer().newInstance();
}
- @Test
+ @ContractTest
public void testMoreIndexing() {
final int num = 10;
final Seq seq = getSeqProducer().newInstance();
@@ -159,22 +157,22 @@ public class SeqContractTests<T extends
assertEquals(retained, seq.iterator().toList());
}
- @Test
+ @ContractTest
public void testRemoveA() {
testRemove(bools("tttffffftt"));
}
- @Test
+ @ContractTest
public void testRemoveB() {
testRemove(bools("ftftttttft"));
}
- @Test
+ @ContractTest
public void testRemoveC() {
testRemove(bools("ffffffffff"));
}
- @Test
+ @ContractTest
public void testSeq4() {
final String test = "temp";
int n = 58305;
@@ -306,7 +304,7 @@ public class SeqContractTests<T extends
}
}
- @Test
+ @ContractTest
public void testSeq5() {
final Seq seq5 = getSeqProducer().newInstance();
final String test = "seq5";
@@ -359,7 +357,7 @@ public class SeqContractTests<T extends
}
}
- @Test
+ @ContractTest
public void testSeq6() {
final String test = "seq6";
int n = 0;
@@ -490,7 +488,7 @@ public class SeqContractTests<T extends
}
}
- @Test
+ @ContractTest
public void testSeq7() {
final Seq seq7 = getSeqProducer().newInstance();
final String test = "seq7";
@@ -760,7 +758,7 @@ public class SeqContractTests<T extends
}
}
- @Test
+ @ContractTest
public void testSeqAccessByIndexing() {
// LitTestObj tvObject = new LitTestObj(12345);
final Literal tvLiteral = literal("'test 12 string 2'");
@@ -819,7 +817,7 @@ public class SeqContractTests<T extends
}
}
- @Test
+ @ContractTest
public void testSeqAdd() {
final Seq seq = getSeqProducer().newInstance();
assertEquals(0, seq.size());
@@ -878,7 +876,7 @@ public class SeqContractTests<T extends
assertEquals(11, seq.size());
}
- @Test
+ @ContractTest
public void testSeqAddInts() {
final int num = 10;
final Seq seq = getSeqProducer().newInstance();
@@ -893,7 +891,7 @@ public class SeqContractTests<T extends
}
}
- @Test
+ @ContractTest
public void testSeqInsertByIndexing() {
// LitTestObj tvObject = new LitTestObj(12345);
final Literal tvLiteral = literal("'test 12 string 2'");
@@ -957,7 +955,7 @@ public class SeqContractTests<T extends
assertEquals(15, seq.indexOf(true));
}
- @Test
+ @ContractTest
public void testSet() {
// NodeIterator nIter;
// StmtIterator sIter;
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/StatementContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/StatementContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/StatementContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/StatementContractTests.java Sun Jan 5 11:28:03 2014
@@ -26,6 +26,8 @@ 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.shared.PropertyNotFoundException;
+
+import org.xenei.junit.contract.ContractTest;
import org.xenei.junit.contract.IProducer;
import com.hp.hpl.jena.testing_framework.IStatementProducer;
@@ -37,13 +39,10 @@ import com.hp.hpl.jena.vocabulary.RDF;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
import static org.junit.Assert.*;
import org.xenei.junit.contract.Contract;
-@Ignore
@Contract(Statement.class)
public class StatementContractTests<T extends Statement> {
private IStatementProducer<T> producer;
@@ -95,7 +94,7 @@ public class StatementContractTests<T ex
CL.assertHas("remove", stmt, "add", stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_boolean() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -105,7 +104,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_boolean_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -115,7 +114,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_char() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -125,7 +124,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_char_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -135,7 +134,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_double() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -145,7 +144,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_double_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -155,7 +154,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_float() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -165,7 +164,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_float_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -175,7 +174,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_int() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -185,7 +184,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_int_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -195,7 +194,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_long() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -205,7 +204,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeLiteralObject_long_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -215,7 +214,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_RDFNode() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -225,7 +224,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_RDFNode_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -235,7 +234,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_String() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -245,7 +244,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_String_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -255,7 +254,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_String_boolean() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -265,7 +264,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_String_boolean_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -275,7 +274,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_String_String() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -285,7 +284,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_String_String_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -295,7 +294,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_String_String_boolean() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -305,7 +304,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testChangeObject_String_String_boolean_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -315,7 +314,7 @@ public class StatementContractTests<T ex
assertInModel(stmt, stmt2);
}
- @Test
+ @ContractTest
public void testCreateReifiedStatement() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -336,7 +335,7 @@ public class StatementContractTests<T ex
assertFalse(model.contains(stmt));
}
- @Test
+ @ContractTest
public void testCreateReifiedStatement_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -357,7 +356,7 @@ public class StatementContractTests<T ex
assertTrue(model.contains(stmt));
}
- @Test
+ @ContractTest
public void testCreateReifiedStatement_String() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -380,7 +379,7 @@ public class StatementContractTests<T ex
assertFalse(model.contains(stmt));
}
- @Test
+ @ContractTest
public void testCreateReifiedStatement_String_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertOfModel(stmt);
@@ -403,7 +402,7 @@ public class StatementContractTests<T ex
assertTrue(model.contains(stmt));
}
- @Test
+ @ContractTest
public void testEquals_Object() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertTrue(statement("s p o").equals(stmt));
@@ -412,7 +411,7 @@ public class StatementContractTests<T ex
assertEquals(stmt.hashCode(), statement("s p o").hashCode());
}
- @Test
+ @ContractTest
public void testGetAlt() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -432,7 +431,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetAlt_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -455,7 +454,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetBag() {
Statement stmt = getStatementProducer().newInstance("s p 'foo'");
model.register(CL);
@@ -486,7 +485,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetBag_InModel() {
Statement stmt = getStatementProducer().newInstance("s p 'foo'");
model.register(CL);
@@ -520,7 +519,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetBoolean() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -539,7 +538,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetBoolean_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -561,7 +560,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetByte() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -580,7 +579,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetByte_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -603,7 +602,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetChar() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -622,7 +621,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetChar_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -645,7 +644,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetDouble() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -664,7 +663,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetDouble_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -687,7 +686,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetFloat() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -706,7 +705,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetFloat_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -729,7 +728,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetInt() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -748,7 +747,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetInt_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -771,7 +770,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetLanguage() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -789,7 +788,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetLanguage_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -811,7 +810,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetLiteral() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -830,7 +829,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetLong() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -849,7 +848,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetLong_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -871,25 +870,25 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertSame(model, stmt.getModel());
}
- @Test
+ @ContractTest
public void testGetObject() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertEquals(resource("o"), stmt.getObject());
}
- @Test
+ @ContractTest
public void testGetPredicate() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertEquals(property("p"), stmt.getPredicate());
}
- @Test
+ @ContractTest
public void testGetProperty_Property() {
Statement stmt = getStatementProducer().newInstance(resource("s"),
property("p"), model.createTypedLiteral(true));
@@ -913,7 +912,7 @@ public class StatementContractTests<T ex
assertEquals(statement("o p2 q"), stmt3);
}
- @Test
+ @ContractTest
public void testGetProperty_Property_InModel() {
Statement stmt = getStatementProducer().newInstance(resource("a"),
property("p"), model.createTypedLiteral(true));
@@ -932,7 +931,7 @@ public class StatementContractTests<T ex
assertEquals(statement("o p2 q"), stmt2);
}
- @Test
+ @ContractTest
public void testGetResource() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertEquals(resource("o"), stmt.getResource());
@@ -945,7 +944,7 @@ public class StatementContractTests<T ex
}
}
- @Test
+ @ContractTest
public void testGetSeq() {
Statement stmt;
@@ -978,7 +977,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetSeq_InModel() {
Statement stmt = getStatementProducer().newInstance("s p 'foo'");
model.register(CL);
@@ -1012,7 +1011,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetShort() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -1031,7 +1030,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetShort_InModel() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -1052,7 +1051,7 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testGetStatementProperty_Property() {
Statement stmt = getStatementProducer().newInstance(resource("s"),
property("p"), model.createTypedLiteral(true));
@@ -1078,7 +1077,7 @@ public class StatementContractTests<T ex
assertEquals(statement(rstmt, property("p2"), resource("q")), stmt3);
}
- @Test
+ @ContractTest
public void testGetStatementProperty_Property_InModel() {
Statement stmt = getStatementProducer().newInstance(resource("s"),
property("p"), model.createTypedLiteral(true));
@@ -1105,7 +1104,7 @@ public class StatementContractTests<T ex
assertEquals(statement(rstmt, property("p2"), resource("q")), stmt3);
}
- @Test
+ @ContractTest
public void testGetString() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.register(CL);
@@ -1124,13 +1123,13 @@ public class StatementContractTests<T ex
CL.assertEmpty();
}
- @Test
+ @ContractTest
public void testHashCode() {
// just verify that it works
getStatementProducer().newInstance("s p o").hashCode();
}
- @Test
+ @ContractTest
public void testHasWellFormedXML() {
assertFalse(getStatementProducer().newInstance("s P 1")
.hasWellFormedXML());
@@ -1140,7 +1139,7 @@ public class StatementContractTests<T ex
"S P '<x></x>'rdf:XMLLiteral").hasWellFormedXML());
}
- @Test
+ @ContractTest
public void testIsReified() {
Statement stmt = getStatementProducer().newInstance("s p o");
assertFalse(stmt.isReified());
@@ -1148,7 +1147,7 @@ public class StatementContractTests<T ex
assertTrue(stmt.isReified());
}
- @Test
+ @ContractTest
public void testListReifiedStatements() {
Statement stmt = getStatementProducer().newInstance("s p o");
stmt.createReifiedStatement();
@@ -1161,7 +1160,7 @@ public class StatementContractTests<T ex
assertTrue(model.contains(r, RDF.object, stmt.getObject()));
}
- @Test
+ @ContractTest
public void testRemove() {
Statement stmt = getStatementProducer().newInstance("s p o");
model.add(stmt);
@@ -1175,7 +1174,7 @@ public class StatementContractTests<T ex
CL.assertHas("remove", stmt);
}
- @Test
+ @ContractTest
public void testRemoveReification() {
Statement stmt = getStatementProducer().newInstance("s p o");
@@ -1210,7 +1209,7 @@ public class StatementContractTests<T ex
// TODO END OF EDIT
- @Test
+ @ContractTest
public void testOtherStuff() {
final Model A = getModelProducer().newInstance();
final Model B = getModelProducer().newInstance();
@@ -1259,7 +1258,7 @@ public class StatementContractTests<T ex
Assert.assertTrue("X5", A.isIsomorphicWith(B));
}
- @Test
+ @ContractTest
public void testSet() {
final Resource S = resource("jena:S");
// model.createResource("jena:R");
@@ -1281,7 +1280,7 @@ public class StatementContractTests<T ex
* Feeble test that toString'ing a Statement[Impl] will display the
* data-type of its object if it has one.
*/
- @Test
+ @ContractTest
public void testStatementPrintsType() {
final String fakeURI = "fake:URI";
final Resource S = resource();
@@ -1291,7 +1290,7 @@ public class StatementContractTests<T ex
Assert.assertTrue(st.toString().indexOf(fakeURI) > 0);
}
- @Test
+ @ContractTest
public void testStatmentMap1Selectors() {
Statement s = getStatementProducer().newInstance("sub pred obj");
Assert.assertEquals(resource("sub"), Statement.Util.getSubject.map1(s));
@@ -1305,7 +1304,7 @@ public class StatementContractTests<T ex
* asserted constructed by a different model should test equal to the
* resource extracted from that statement, even if it's a bnode.
*/
- @Test
+ @ContractTest
public void testStuff() {
final Model red = getModelProducer().newInstance();
final Model blue = getModelProducer().newInstance();
@@ -1316,7 +1315,7 @@ public class StatementContractTests<T ex
Assert.assertEquals("object preserved", r, s.getObject());
}
- @Test
+ @ContractTest
public void testTripleWrapper() {
assertInstanceOf(FrontsTriple.class, getStatementProducer()
.newInstance("s p o"));
Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/InfModelTest.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/InfModelTest.java?rev=1555482&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/InfModelTest.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/InfModelTest.java Sun Jan 5 11:28:03 2014
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.rdf.model.impl;
+
+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.rdf.model.InfModel;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelCon;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Statement;
+import com.hp.hpl.jena.reasoner.InfGraph;
+import com.hp.hpl.jena.reasoner.Reasoner;
+import com.hp.hpl.jena.reasoner.rulesys.BasicForwardRuleInfGraph;
+import com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveReasoner;
+import com.hp.hpl.jena.sparql.graph.GraphFactory;
+import com.hp.hpl.jena.testing_framework.AbstractInfModelProducer;
+
+@RunWith(ContractSuite.class)
+@ContractImpl(value=InfModel.class, skip={ Model.class, ModelCon.class })
+public class InfModelTest {
+
+ private AbstractInfModelProducer<InfModel> producer = new AbstractInfModelProducer<InfModel>() {
+
+ private Reasoner reasoner = new TransitiveReasoner();
+
+ @Override
+ protected InfModel createNewModel() {
+// reasoner.bind( GraphFactory.createGraphMem() );
+// Graph schema = null;
+// InfGraph g = new BasicForwardRuleInfGraph(reasoner, null, null, GraphFactory.createGraphMem());
+// return new InfModelImpl(g);
+ Model schema = ModelFactory.createDefaultModel();
+ Model model = ModelFactory.createDefaultModel();
+ return ModelFactory.createRDFSModel( schema, model );
+ }
+
+ @Override
+ public boolean areIndependent() {
+ return true;
+ }
+
+ @Override
+ public Reasoner getReasoner() {
+ return reasoner;
+ }
+
+ @Override
+ public Model getBoundModel() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void populateModel(InfModel model) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Statement getDerivationStatement() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Statement getNoDerivationStatement() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean supportsDeductionsModel() {
+ return true;
+ }
+
+ };
+
+ @Contract.Inject
+ public AbstractInfModelProducer<InfModel> getModelProducer() {
+ return producer;
+ }
+
+}
Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/InfModelTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/ModelComSuite.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/ModelComSuite.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/ModelComSuite.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/impl/ModelComSuite.java Sun Jan 5 11:28:03 2014
@@ -1,4 +1,5 @@
package com.hp.hpl.jena.rdf.model.impl;
+
//
//import org.junit.runner.RunWith;
//import org.xenei.junit.contract.ContractImpl;
@@ -31,4 +32,4 @@ package com.hp.hpl.jena.rdf.model.impl;
// return producer;
// }
//
-//}
+// }
Added: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/reasoner/InfGraphContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/reasoner/InfGraphContractTests.java?rev=1555482&view=auto
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/reasoner/InfGraphContractTests.java (added)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/reasoner/InfGraphContractTests.java Sun Jan 5 11:28:03 2014
@@ -0,0 +1,187 @@
+//package com.hp.hpl.jena.reasoner;
+//
+//import java.util.ArrayList;
+//import java.util.Arrays;
+//import java.util.Iterator;
+//import java.util.List;
+//
+//import org.junit.After;
+//import org.junit.Before;
+//import org.junit.Ignore;
+//import org.junit.Test;
+//
+//import static com.hp.hpl.jena.testing_framework.ModelHelper.modelAdd;
+//import static com.hp.hpl.jena.testing_framework.ModelHelper.property;
+//import static com.hp.hpl.jena.testing_framework.ModelHelper.resource;
+//import static com.hp.hpl.jena.testing_framework.ModelHelper.statements;
+//import static com.hp.hpl.jena.testing_framework.ModelHelper.txnBegin;
+//import static com.hp.hpl.jena.testing_framework.ModelHelper.txnCommit;
+//import static org.junit.Assert.*;
+//
+//import org.xenei.junit.contract.Contract;
+//import org.xenei.junit.contract.IProducer;
+//
+//
+//import com.hp.hpl.jena.graph.Graph;
+//import com.hp.hpl.jena.graph.Node;
+//import com.hp.hpl.jena.graph.Triple;
+//import com.hp.hpl.jena.reasoner.Derivation;
+//import com.hp.hpl.jena.reasoner.Reasoner;
+//import com.hp.hpl.jena.reasoner.ValidityReport;
+//import com.hp.hpl.jena.testing_framework.AbstractInfModelProducer;
+//import com.hp.hpl.jena.testing_framework.AbstractModelProducer;
+//import com.hp.hpl.jena.testing_framework.ContractTemplate;
+//import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+//import com.hp.hpl.jena.vocabulary.RDF;
+//
+//@Ignore
+//@Contract(InfGraph.class)
+//public class InfGraphContractTests<T extends InfGraph> extends ContractTemplate<IProducer<T>> {
+//
+// public interface InfGraphProducer<T> extends IProducer<T> {
+// /**
+// * Return the raw RDF data Graph being processed (i.e. the argument
+// * to the Reasonder.bind call that created this InfGraph).
+// */
+// public Graph getBindGraph();
+//
+// /**
+// * Return the Reasoner which is being used to answer queries to this graph.
+// */
+// public Reasoner getReasoner();
+// }
+//
+//
+// public InfGraphContractTests() {
+// }
+//
+// @Contract.Inject
+// public final void setInfGraphContractTestProducer(InfGraphProducer<T> graphProducer) {
+// super.setProducer(graphProducer);
+// }
+//
+// @After
+// public final void afterInfGraphContractTests() {
+// getProducer().cleanUp();
+// }
+//
+// /**
+// * Return the raw RDF data Graph being processed (i.e. the argument
+// * to the Reasonder.bind call that created this InfGraph).
+// */
+// public void testGetRawGraph()
+// {
+// InfGraph graph = getProducer().newInstance();
+// Graph g = graph.getRawGraph();
+// assertNotNull( "Raw graph may not be null", g );
+// assertEquals( "Raw graph is not correct graph", getProducer().g)
+// }
+//
+// /**
+// * Return the Reasoner which is being used to answer queries to this graph.
+// */
+// public Reasoner getReasoner();
+//
+// /**
+// * Replace the underlying data graph for this inference graph and start any
+// * inferences over again. This is primarily using in setting up ontology imports
+// * processing to allow an imports multiunion graph to be inserted between the
+// * inference graph and the raw data, before processing.
+// * @param data the new raw data graph
+// */
+// public void rebind(Graph data);
+//
+// /**
+// * Cause the inference graph to reconsult the underlying graph to take
+// * into account changes. Normally changes are made through the InfGraph's add and
+// * remove calls are will be handled appropriately. However, in some cases changes
+// * are made "behind the InfGraph's back" and this forces a full reconsult of
+// * the changed data.
+// */
+// public void rebind();
+//
+// /**
+// * Perform any initial processing and caching. This call is optional. Most
+// * engines either have negligable set up work or will perform an implicit
+// * "prepare" if necessary. The call is provided for those occasions where
+// * substantial preparation work is possible (e.g. running a forward chaining
+// * rule system) and where an application might wish greater control over when
+// * this prepration is done.
+// */
+// public void prepare();
+//
+// /**
+// * Reset any internal caches. Some systems, such as the tabled backchainer,
+// * retain information after each query. A reset will wipe this information preventing
+// * unbounded memory use at the expense of more expensive future queries. A reset
+// * does not cause the raw data to be reconsulted and so is less expensive than a rebind.
+// */
+// public void reset();
+//
+// /**
+// * Test a global boolean property of the graph. This might included
+// * properties like consistency, OWLSyntacticValidity etc.
+// * It remains to be seen what level of generality is needed here. We could
+// * replace this by a small number of specific tests for common concepts.
+// * @param property the URI of the property to be tested
+// * @return a Node giving the value of the global property, this may
+// * be a boolean literal, some other literal value (e.g. a size).
+// */
+// public Node getGlobalProperty(Node property);
+//
+// /**
+// * A convenience version of getGlobalProperty which can only return
+// * a boolean result.
+// */
+// public boolean testGlobalProperty(Node property);
+//
+// /**
+// * Test the consistency of the bound data. This normally tests
+// * the validity of the bound instance data against the bound
+// * schema data.
+// * @return a ValidityReport structure
+// */
+// public ValidityReport validate();
+//
+// /**
+// * An extension of the Graph.find interface which allows the caller to
+// * encode complex expressions in RDF and then refer to those expressions
+// * within the query triple. For example, one might encode a class expression
+// * and then ask if there are any instances of this class expression in the
+// * InfGraph.
+// * @param subject the subject Node of the query triple, may be a Node in
+// * the graph or a node in the parameter micro-graph or null
+// * @param property the property to be retrieved or null
+// * @param object the object Node of the query triple, may be a Node in
+// * the graph or a node in the parameter micro-graph.
+// * @param param a small graph encoding an expression which the subject and/or
+// * object nodes refer.
+// */
+// public ExtendedIterator<Triple> find(Node subject, Node property, Node object, Graph param);
+//
+// /**
+// * Switch on/off drivation logging
+// */
+// public void setDerivationLogging(boolean logOn);
+//
+// /**
+// * Return the derivation of the given triple (which is the result of
+// * some previous find operation).
+// * Not all reasoneers will support derivations.
+// * @return an iterator over Derivation records or null if there is no derivation information
+// * available for this triple.
+// */
+// public Iterator<Derivation> getDerivation(Triple triple);
+//
+// /**
+// * Returns a derivations graph. The rule reasoners typically create a
+// * graph containing those triples added to the base graph due to rule firings.
+// * In some applications it can useful to be able to access those deductions
+// * directly, without seeing the raw data which triggered them. In particular,
+// * this allows the forward rules to be used as if they were rewrite transformation
+// * rules.
+// * @return the deductions graph, if relevant for this class of inference
+// * engine or null if not.
+// */
+// public Graph getDeductionsGraph();
+// }
Propchange: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/reasoner/InfGraphContractTests.java
------------------------------------------------------------------------------
svn:mime-type = text/plain