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 [4/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/ModelConContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelConContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelConContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelConContractTests.java Sun Jan 5 11:28:03 2014
@@ -26,11 +26,10 @@ import java.util.List;
import org.junit.After;
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;
import com.hp.hpl.jena.datatypes.BaseDatatype;
import com.hp.hpl.jena.datatypes.RDFDatatype;
@@ -54,10 +53,9 @@ import com.hp.hpl.jena.vocabulary.RDF;
* independent or not.
*
*/
-@Ignore
@Contract(ModelCon.class)
public class ModelConContractTests<T extends ModelCon> extends
- ContractTemplate<T> {
+ ContractTemplate<IProducer<T>> {
private ModelCon modelCon;
private Model model;
@@ -88,7 +86,7 @@ public class ModelConContractTests<T ext
getProducer().cleanUp();
}
- @Test
+ @ContractTest
public void testAdd_Resource_Property_RDFNode() {
Statement s = statement("S P O");
model.register(SL);
@@ -102,7 +100,7 @@ public class ModelConContractTests<T ext
Assert.assertTrue(model.contains(s));
}
- @Test
+ @ContractTest
public void testAdd_Resource_Property_String() {
Statement s = statement("S P 'foo'");
model.register(SL);
@@ -115,7 +113,7 @@ public class ModelConContractTests<T ext
Assert.assertTrue(model.contains(s));
}
- @Test
+ @ContractTest
public void testAdd_Resource_Property_String_Boolean() {
RDFDatatype dt = new BaseDatatype(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
@@ -142,7 +140,7 @@ public class ModelConContractTests<T ext
assertTrue("Statement not found in model", model.contains(s2));
}
- @Test
+ @ContractTest
public void testAdd_Resource_Property_String_RDFDataType() {
Literal lit = ResourceFactory.createTypedLiteral("foo",
XSDDatatype.XSDstring);
@@ -157,7 +155,7 @@ public class ModelConContractTests<T ext
assertTrue("Statement not found in model", model.contains(s));
}
- @Test
+ @ContractTest
public void testAdd_Resource_Property_String_String() {
Resource S = resource("S");
@@ -186,7 +184,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.contains(S, P, "test string", "en"));
}
- @Test
+ @ContractTest
public void testAddLiteral_Resource_Property_boolean() {
Resource S = resource("S");
Property P = property("P");
@@ -203,7 +201,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testAddLiteral_Resource_Property_char() {
Resource S = resource("S");
Property P = property("P");
@@ -222,7 +220,7 @@ public class ModelConContractTests<T ext
Assert.assertTrue(modelCon.containsLiteral(S, P, tvChar));
}
- @Test
+ @ContractTest
public void testAddLiteral_Resource_Property_double() {
Resource S = resource("S");
Property P = property("P");
@@ -241,7 +239,7 @@ public class ModelConContractTests<T ext
Assert.assertTrue(modelCon.containsLiteral(S, P, tvDouble));
}
- @Test
+ @ContractTest
public void testAddLiteral_Resource_Property_float() {
Resource S = resource("S");
Property P = property("P");
@@ -260,7 +258,7 @@ public class ModelConContractTests<T ext
Assert.assertTrue(modelCon.containsLiteral(S, P, tvFloat));
}
- @Test
+ @ContractTest
public void testAddLiteral_Resource_Property_int() {
Resource S = resource("S");
Property P = property("P");
@@ -279,7 +277,7 @@ public class ModelConContractTests<T ext
Assert.assertTrue(modelCon.containsLiteral(S, P, tvInt));
}
- @Test
+ @ContractTest
public void testAddLiteral_Resource_Property_Literal() {
Resource S = resource("S");
Property P = property("P");
@@ -298,7 +296,7 @@ public class ModelConContractTests<T ext
Assert.assertTrue(modelCon.containsLiteral(S, P, O));
}
- @Test
+ @ContractTest
public void testAddLiteral_Resource_Property_long() {
Resource S = resource("S");
Property P = property("P");
@@ -317,7 +315,7 @@ public class ModelConContractTests<T ext
Assert.assertTrue(modelCon.containsLiteral(S, P, tvLong));
}
- @Test
+ @ContractTest
public void testContains_Resource_Property_String() {
Resource S = resource("S");
Property P = property("P");
@@ -339,7 +337,7 @@ public class ModelConContractTests<T ext
model.contains(null, property("P2"), (RDFNode) null));
}
- @Test
+ @ContractTest
public void testContains_Resource_Property_String_String() {
Resource S = resource("S");
Property P = property("P");
@@ -372,7 +370,7 @@ public class ModelConContractTests<T ext
assertFalse("Extra resource", model.contains(null, null, "foo", "en"));
}
- @Test
+ @ContractTest
public void testContainsLiteral_Resource_Property_boolean() {
Resource S = resource("S");
Property P = property("P");
@@ -389,7 +387,7 @@ public class ModelConContractTests<T ext
assertFalse("extra resource", modelCon.containsLiteral(S, P, false));
}
- @Test
+ @ContractTest
public void testContainsLiteral_Resource_Property_char() {
Resource S = resource("S");
Property P = property("P");
@@ -405,7 +403,7 @@ public class ModelConContractTests<T ext
assertFalse("extra resource", modelCon.containsLiteral(S, P, 'b'));
}
- @Test
+ @ContractTest
public void testContainsLiteral_Resource_Property_double() {
Resource S = resource("S");
Property P = property("P");
@@ -422,7 +420,7 @@ public class ModelConContractTests<T ext
assertFalse("extra resource", modelCon.containsLiteral(S, P, 8.5d));
}
- @Test
+ @ContractTest
public void testContainsLiteral_Resource_Property_float() {
Resource S = resource("S");
Property P = property("P");
@@ -439,7 +437,7 @@ public class ModelConContractTests<T ext
assertFalse("extra resource", modelCon.containsLiteral(S, P, 8.5f));
}
- @Test
+ @ContractTest
public void testContainsLiteral_Resource_Property_int() {
Resource S = resource("S");
Property P = property("P");
@@ -456,7 +454,7 @@ public class ModelConContractTests<T ext
assertFalse("extra resource", modelCon.containsLiteral(S, P, 10));
}
- @Test
+ @ContractTest
public void testContainsLiteral_Resource_Property_long() {
Resource S = resource("S");
Property P = property("P");
@@ -473,7 +471,7 @@ public class ModelConContractTests<T ext
assertFalse("extra resource", modelCon.containsLiteral(S, P, 100L));
}
- @Test
+ @ContractTest
public void testContainsLiteral_Resource_Property_Object() {
Resource S = resource("S");
Property P = property("P");
@@ -495,7 +493,7 @@ public class ModelConContractTests<T ext
/**
* create Alt will
*/
- @Test
+ @ContractTest
public void testCreateAlt() {
model.register(SL);
@@ -516,7 +514,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testCreateAlt_String() {
model.register(SL);
txnBegin(model);
@@ -536,7 +534,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testCreateBag() {
model.register(SL);
@@ -556,7 +554,7 @@ public class ModelConContractTests<T ext
tvBag.getModel());
}
- @Test
+ @ContractTest
public void testCreateBag_String() {
model.register(SL);
txnBegin(model);
@@ -577,7 +575,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testLiteral_String() {
model.register(SL);
txnBegin(model);
@@ -588,7 +586,7 @@ public class ModelConContractTests<T ext
assertFalse("Should not be in model", model.contains(null, null, l));
}
- @Test
+ @ContractTest
public void testCreateLiteralStatement_Resource_Property_boolean() {
model.register(SL);
txnBegin(model);
@@ -600,7 +598,7 @@ public class ModelConContractTests<T ext
assertFalse("Should not be in model", model.contains(s));
}
- @Test
+ @ContractTest
public void testCreateLiteralStatement_Resource_Property_char() {
model.register(SL);
txnBegin(model);
@@ -612,7 +610,7 @@ public class ModelConContractTests<T ext
assertFalse("Should not be in model", model.contains(s));
}
- @Test
+ @ContractTest
public void testCreateLiteralStatement_Resource_Property_double() {
model.register(SL);
txnBegin(model);
@@ -624,7 +622,7 @@ public class ModelConContractTests<T ext
assertFalse("Should not be in model", model.contains(s));
}
- @Test
+ @ContractTest
public void testCreateLiteralStatement_Resource_Property_float() {
model.register(SL);
txnBegin(model);
@@ -636,7 +634,7 @@ public class ModelConContractTests<T ext
assertFalse("Should not be in model", model.contains(s));
}
- @Test
+ @ContractTest
public void testCreateLiteralStatement_Resource_Property_int() {
model.register(SL);
txnBegin(model);
@@ -648,7 +646,7 @@ public class ModelConContractTests<T ext
assertFalse("Should not be in model", model.contains(s));
}
- @Test
+ @ContractTest
public void testCreateLiteralStatement_Resource_Property_long() {
model.register(SL);
txnBegin(model);
@@ -660,7 +658,7 @@ public class ModelConContractTests<T ext
assertFalse("Should not be in model", model.contains(s));
}
- @Test
+ @ContractTest
public void testCreateLiteralStatement_Resource_Property_Object() {
model.register(SL);
txnBegin(model);
@@ -672,7 +670,7 @@ public class ModelConContractTests<T ext
assertFalse("Should not be in model", model.contains(s));
}
- @Test
+ @ContractTest
public void testCreateProperty_String() {
model.register(SL);
txnBegin(model);
@@ -685,7 +683,7 @@ public class ModelConContractTests<T ext
assertEquals("ex:/test", p.getURI());
}
- @Test
+ @ContractTest
public void testCreateResource_Resource() {
Resource typ = resource("ex:/type");
model.register(SL);
@@ -698,7 +696,7 @@ public class ModelConContractTests<T ext
assertTrue("Should be in model", model.contains(r, RDF.type, typ));
}
- @Test
+ @ContractTest
public void testCreateResource_String_Resource() {
Resource typ = resource("ex:/type");
model.register(SL);
@@ -711,7 +709,7 @@ public class ModelConContractTests<T ext
assertTrue("Should be in model", model.contains(r, RDF.type, typ));
}
- @Test
+ @ContractTest
public void testCreateSeq() {
model.register(SL);
@@ -731,7 +729,7 @@ public class ModelConContractTests<T ext
tvSeq.getModel());
}
- @Test
+ @ContractTest
public void testCreateSeq_String() {
model.register(SL);
txnBegin(model);
@@ -752,7 +750,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testCreateStatement_Resource_Property_String() {
Literal lit = ResourceFactory.createPlainLiteral("foo");
model.register(SL);
@@ -771,7 +769,7 @@ public class ModelConContractTests<T ext
assertEquals("Wrong object", lit, s.getObject());
}
- @Test
+ @ContractTest
public void testCreateStatement_Resource_Property_String_boolean() {
RDFDatatype dt = new BaseDatatype(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
@@ -797,7 +795,7 @@ public class ModelConContractTests<T ext
assertEquals(lit.getString(), lit2.getString());
}
- @Test
+ @ContractTest
public void testCreateStatement_Resource_Property_String_String() {
Literal lit = literal("foo", "fr");
model.register(SL);
@@ -820,7 +818,7 @@ public class ModelConContractTests<T ext
/**
* statement is not in model
*/
- @Test
+ @ContractTest
public void testCreateStatement_Resource_Property_String_String_boolean() {
RDFDatatype dt = new BaseDatatype(
"http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral");
@@ -847,7 +845,7 @@ public class ModelConContractTests<T ext
assertEquals("Wrong object", lit, s.getObject());
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_boolean() {
model.register(SL);
txnBegin(model);
@@ -862,7 +860,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", true, l.getBoolean());
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_Calendar() {
Calendar c = Calendar.getInstance();
XSDDateTime dt = new XSDDateTime(c);
@@ -880,7 +878,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", dt, l.getValue());
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_char() {
model.register(SL);
txnBegin(model);
@@ -895,7 +893,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", 'c', l.getChar());
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_double() {
model.register(SL);
txnBegin(model);
@@ -910,7 +908,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", 4.5d, l.getDouble(), 0);
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_float() {
float f = 4.5f;
model.register(SL);
@@ -926,7 +924,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", f, l.getFloat(), 0);
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_int() {
model.register(SL);
txnBegin(model);
@@ -941,7 +939,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", 5, l.getInt());
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_long() {
model.register(SL);
txnBegin(model);
@@ -956,11 +954,11 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", 5L, l.getLong());
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_Object() {
model.register(SL);
TypeMapper.reset();
-
+
try {
final LitTestObj ra = new LitTestObj("r11");
final LitTestObj rb = new LitTestObj("r12");
@@ -998,7 +996,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_Object_String() {
RDFDatatype dt = new BaseDatatype("http://example.com/objType");
model.register(SL);
@@ -1015,7 +1013,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", tvObject, l.getValue());
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_String() {
model.register(SL);
txnBegin(model);
@@ -1030,7 +1028,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", "foo", l.getValue());
}
- @Test
+ @ContractTest
public void testCreateTypedLiteral_String_String() {
RDFDatatype dt = new BaseDatatype("http://example.com/strType");
model.register(SL);
@@ -1047,7 +1045,7 @@ public class ModelConContractTests<T ext
assertEquals("wrong value", "foo", l.getString());
}
- @Test
+ @ContractTest
public void testGetAlt_Resource() {
model.register(SL);
@@ -1062,12 +1060,11 @@ public class ModelConContractTests<T ext
Alt alt = modelCon.getAlt(r);
// verify alt settings
- assertSame("must be of the model", modelCon,
- alt.getModel());
+ assertSame("must be of the model", modelCon, alt.getModel());
assertEquals("must be uri", r.getURI(), alt.getURI());
assertFalse("model must not contain statement", model.listStatements()
.hasNext());
- assertFalse( "must not be an alt", alt.isAlt());
+ assertFalse("must not be an alt", alt.isAlt());
SL.assertEmpty();
// add the alt to the model
@@ -1078,13 +1075,12 @@ public class ModelConContractTests<T ext
Alt alt2 = modelCon.getAlt(r);
SL.assertEmpty();
- assertSame("must be of the model", modelCon,
- alt2.getModel());
+ assertSame("must be of the model", modelCon, alt2.getModel());
assertEquals("must be uri", r.getURI(), alt2.getURI());
- assertTrue( "must be an alt", alt2.isAlt());
+ assertTrue("must be an alt", alt2.isAlt());
}
- @Test
+ @ContractTest
public void testGetAlt_String() {
model.register(SL);
@@ -1100,7 +1096,7 @@ public class ModelConContractTests<T ext
assertEquals("must be uri", "O", alt.getURI());
assertFalse("model must not contain statement", model.listStatements()
.hasNext());
- assertFalse( "must not be an alt", alt.isAlt());
+ assertFalse("must not be an alt", alt.isAlt());
SL.assertEmpty();
// add the alt to the model
@@ -1116,7 +1112,7 @@ public class ModelConContractTests<T ext
assertTrue("must be an alt", alt2.isAlt());
}
- @Test
+ @ContractTest
public void testGetBag_Resource() {
model.register(SL);
@@ -1131,12 +1127,11 @@ public class ModelConContractTests<T ext
Bag bag = modelCon.getBag(r);
// verify bag settings
- assertSame("must be of the model", modelCon,
- bag.getModel());
+ assertSame("must be of the model", modelCon, bag.getModel());
assertEquals("must be uri", r.getURI(), bag.getURI());
assertFalse("model must not contain statement", model.listStatements()
.hasNext());
- assertFalse( "must not be a bag", bag.isBag());
+ assertFalse("must not be a bag", bag.isBag());
SL.assertEmpty();
// add the bag to the model
@@ -1150,14 +1145,13 @@ public class ModelConContractTests<T ext
Bag bag2 = modelCon.getBag(r);
// SL.assertEmpty();
- assertSame( "must be of the model", modelCon,
- bag2.getModel());
+ assertSame("must be of the model", modelCon, bag2.getModel());
assertEquals("must be uri", r.getURI(), bag2.getURI());
- assertTrue( "must be a bag", bag2.isBag());
+ assertTrue("must be a bag", bag2.isBag());
}
- @Test
+ @ContractTest
public void testGetBag_String() {
model.register(SL);
@@ -1169,7 +1163,7 @@ public class ModelConContractTests<T ext
assertEquals("must be uri", "O", bag.getURI());
assertFalse("model must not contain statement", model.listStatements()
.hasNext());
- assertFalse( "must not be a bag", bag.isBag());
+ assertFalse("must not be a bag", bag.isBag());
SL.assertEmpty();
// add the bag to the model
@@ -1186,7 +1180,7 @@ public class ModelConContractTests<T ext
assertTrue("must be a bag", bag2.isBag());
}
- @Test
+ @ContractTest
public void testGetProperty_String() {
model.register(SL);
@@ -1213,7 +1207,7 @@ public class ModelConContractTests<T ext
assertEquals("must be uri", "P", p2.getURI());
}
- @Test
+ @ContractTest
public void testGetRDFNode_Node() {
// create the node
@@ -1226,7 +1220,7 @@ public class ModelConContractTests<T ext
.listStatements().hasNext());
}
- @Test
+ @ContractTest
public void testGetSeq_Resource() {
model.register(SL);
@@ -1241,12 +1235,11 @@ public class ModelConContractTests<T ext
Seq seq = modelCon.getSeq(r);
// verify bag settings
- assertSame( "must be of the model", modelCon,
- seq.getModel());
+ assertSame("must be of the model", modelCon, seq.getModel());
assertEquals("must be uri", r.getURI(), seq.getURI());
assertFalse("model must not contain statement", model.listStatements()
.hasNext());
- assertFalse( "must not be a seq", seq.isSeq());
+ assertFalse("must not be a seq", seq.isSeq());
SL.assertEmpty();
// add the seq to the model
@@ -1257,14 +1250,13 @@ public class ModelConContractTests<T ext
Seq seq2 = modelCon.getSeq(r);
SL.assertEmpty();
- assertSame("must be of the model", modelCon,
- seq2.getModel());
+ assertSame("must be of the model", modelCon, seq2.getModel());
assertEquals("must be uri", r.getURI(), seq2.getURI());
assertTrue("must be a seq", seq2.isSeq());
}
- @Test
+ @ContractTest
public void testGetSeq_String() {
model.register(SL);
@@ -1280,7 +1272,7 @@ public class ModelConContractTests<T ext
assertEquals("must be uri", "O", seq.getURI());
assertFalse("model must not contain statement", model.listStatements()
.hasNext());
- assertFalse( "must not be a seq", seq.isSeq());
+ assertFalse("must not be a seq", seq.isSeq());
SL.assertEmpty();
// add the seq to the model
@@ -1293,11 +1285,11 @@ public class ModelConContractTests<T ext
SL.assertEmpty();
assertSame("must be of the model", modelCon, seq2.getModel());
assertEquals("must be uri", "O", seq2.getURI());
- assertTrue( "must be a seq", seq2.isSeq());
+ assertTrue("must be a seq", seq2.isSeq());
}
- @Test
+ @ContractTest
public void testListLiteralStatements_Resource_Property_boolean() {
boolean v1 = true;
boolean v2 = false;
@@ -1321,7 +1313,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListLiteralStatements_Resource_Property_char() {
char v1 = 'c';
char v2 = 'd';
@@ -1345,7 +1337,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListLiteralStatements_Resource_Property_double() {
double v1 = 4.5;
double v2 = 5.4;
@@ -1369,7 +1361,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListLiteralStatements_Resource_Property_float() {
float v1 = 4.5f;
float v2 = 5.4f;
@@ -1393,7 +1385,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListLiteralStatements_Resource_Property_long() {
long v1 = 4L;
long v2 = 5L;
@@ -1417,7 +1409,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListResourcesWithProperty_Property_boolean() {
boolean v1 = true;
boolean v2 = false;
@@ -1444,7 +1436,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListResourcesWithProperty_Property_char() {
char v1 = 'c';
char v2 = 'd';
@@ -1471,7 +1463,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListResourcesWithProperty_Property_double() {
double v1 = 4.5;
double v2 = 5.4;
@@ -1498,7 +1490,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListResourcesWithProperty_Property_float() {
float v1 = 4.5f;
float v2 = 5.4f;
@@ -1525,7 +1517,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListResourcesWithProperty_Property_long() {
long v1 = 4l;
long v2 = 5l;
@@ -1552,7 +1544,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListResourcesWithProperty_Property_Object() {
Object v1 = tvObject;
Object v2 = tvLitObj;
@@ -1579,7 +1571,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListStatements_Resource_Property_String() {
String v1 = "foo";
String v2 = "bar";
@@ -1604,7 +1596,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListStatements_Resource_Property_String_String() {
String v = "foo";
String v2 = "bar";
@@ -1637,7 +1629,7 @@ public class ModelConContractTests<T ext
.toList().size());
}
- @Test
+ @ContractTest
public void testListSubjectsWithProperty_Property_String() {
String v1 = "foo";
String v2 = "bar";
@@ -1665,7 +1657,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testListSubjectsWithProperty_Property_String_String() {
String v = "foo";
@@ -1690,7 +1682,7 @@ public class ModelConContractTests<T ext
.size());
}
- @Test
+ @ContractTest
public void testRemove_Model() {
txnBegin(model);
@@ -1712,7 +1704,7 @@ public class ModelConContractTests<T ext
lst.get(0));
}
- @Test
+ @ContractTest
public void testRemove_Resource_Property_RDFNode() {
txnBegin(model);
@@ -1736,7 +1728,7 @@ public class ModelConContractTests<T ext
}
- @Test
+ @ContractTest
public void testRemove_StmtIterator() {
txnBegin(model);
@@ -1766,7 +1758,7 @@ public class ModelConContractTests<T ext
}
- // @Test
+ // @ContractTest
// public void testChangedListener() {
// final ChangedListener CL = new ChangedListener();
// model.register(CL);
@@ -1797,7 +1789,7 @@ public class ModelConContractTests<T ext
// / FIXME END OF EDIT
- // @Test
+ // @ContractTest
// public void testContains() {
// testContains(false, "", "x");
// testContains(false, "a R b", "x");
@@ -1815,21 +1807,21 @@ public class ModelConContractTests<T ext
// testContains(true, "x R y; a P b; i Q j", "a");
// }
//
- // @Test
+ // @ContractTest
// public void testCreateResourceFromNode() {
// RDFNode S = model.getRDFNode(NodeCreateUtils.create("spoo:S"));
// assertInstanceOf(Resource.class, S);
// assertEquals("spoo:S", ((Resource) S).getURI());
// }
//
- // @Test
+ // @ContractTest
// public void testCreateLiteralFromNode() {
// RDFNode S = model.getRDFNode(NodeCreateUtils.create("42"));
// assertInstanceOf(Literal.class, S);
// assertEquals("42", ((Literal) S).getLexicalForm());
// }
//
- // @Test
+ // @ContractTest
// public void testCreateBlankFromNode() {
// RDFNode S = model.getRDFNode(NodeCreateUtils.create("_Blank"));
// assertInstanceOf(Resource.class, S);
@@ -1839,7 +1831,7 @@ public class ModelConContractTests<T ext
// /**
// * Always retuns a value even if the property is no in the model.
// */
- // @Test
+ // @ContractTest
// public void testGetPropertyURI() {
// modelAdd(model, "x P a; x P b; x R c");
// Assert.assertNotNull(model.getProperty(resource("P").getURI()));
@@ -1847,7 +1839,7 @@ public class ModelConContractTests<T ext
// Assert.assertNotNull(model.getProperty(resource("x").getURI()));
// }
//
- // @Test
+ // @ContractTest
// public void testToStatement() {
// Triple t = triple("a P b");
// Statement s = model.asStatement(t);
@@ -1856,7 +1848,7 @@ public class ModelConContractTests<T ext
// assertEquals(node("b"), s.getObject().asNode());
// }
//
- // @Test
+ // @ContractTest
// public void testAsRDF() {
// verifyPresentAsRDFNode(node("a"), Resource.class);
// verifyPresentAsRDFNode(node("17"), Literal.class);
@@ -1870,14 +1862,14 @@ public class ModelConContractTests<T ext
// assertInstanceOf(nodeClass, r);
// }
//
- // @Test
+ // @ContractTest
// public void testURINodeAsResource() {
// Node n = node("a");
// Resource r = model.wrapAsResource(n);
// assertSame(n, r.asNode());
// }
//
- // @Test
+ // @ContractTest
// public void testLiteralNodeAsResourceFails() {
// try {
// model.wrapAsResource(node("17"));
@@ -1911,7 +1903,7 @@ public class ModelConContractTests<T ext
// * and test that expected ~= initialContent + addedStuff - removed -
// * initialContent.
// */
- // @Test
+ // @ContractTest
// public void testRemoveSPO() {
// ModelCom mc = (ModelCom) ModelFactory.createDefaultModel();
// for (int i = 0; i < cases.length; i += 1)
@@ -1939,7 +1931,7 @@ public class ModelConContractTests<T ext
// return getModelProducer().newModel().add(m);
// }
//
- // @Test
+ // @ContractTest
// public void testAddLiteralByStatement() {
// final Literal L = model.createTypedLiteral(210);
// final Resource S = model.createResource("http://nowhere.man/subject");
@@ -1949,7 +1941,7 @@ public class ModelConContractTests<T ext
// }
//
//
- // @Test
+ // @ContractTest
// public void testAddLiteralByte() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -1957,7 +1949,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(S, P, tvByte));
// }
//
- // @Test
+ // @ContractTest
// public void testAddLiteralChar() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -1965,7 +1957,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(S, P, tvChar));
// }
//
- // @Test
+ // @ContractTest
// public void testAddLiteralDouble() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -1973,7 +1965,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(S, P, tvDouble));
// }
//
- // @Test
+ // @ContractTest
// public void testAddLiteralFloat() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -1981,7 +1973,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(S, P, tvFloat));
// }
//
- // @Test
+ // @ContractTest
// public void testAddLiteralInt() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -1990,7 +1982,7 @@ public class ModelConContractTests<T ext
// }
//
//
- // @Test
+ // @ContractTest
// public void testAddLiteralLong() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -2008,7 +2000,7 @@ public class ModelConContractTests<T ext
//
//
- // @Test
+ // @ContractTest
// public void testAddLiteralShort() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -2016,7 +2008,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(S, P, tvShort));
// }
//
- // @Test
+ // @ContractTest
// public void testAddDuplicateStatementLeavesSizeSame() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -2027,7 +2019,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(size, model.size());
// }
//
- // @Test
+ // @ContractTest
// public void testEmpty() {
// final Resource S = model.createResource("http://nowhere.man/subject");
// final Property P = model.createProperty("http://nowhere.man/predicate");
@@ -2046,7 +2038,7 @@ public class ModelConContractTests<T ext
// Assert.assertFalse(model.contains(S, P, "test string", "en"));
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveStatementByIterator() {
// Statement[] stmts = statements("moon orbits earth; earth orbits sun");
// StmtIterator iter = new StmtIteratorImpl(Arrays.asList(stmts)
@@ -2059,7 +2051,7 @@ public class ModelConContractTests<T ext
// assertEquals(0, model.size());
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveModel() {
// final Model model2 = getModelProducer().newModel();
// modelAdd(model, "a P b; c P d; x Q 1; y Q 2");
@@ -2068,7 +2060,7 @@ public class ModelConContractTests<T ext
// Assert.assertFalse(model2.listStatements().hasNext());
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveModelPartial() {
// Assert.assertEquals("precondition: model must be empty", 0,
// model.size());
@@ -2095,7 +2087,7 @@ public class ModelConContractTests<T ext
// }
// }
//
- // @Test
+ // @ContractTest
// public void testContainsWithNull() {
// testCWN(false, "", null, null, null);
// testCWN(true, "x R y", null, null, null);
@@ -2117,7 +2109,7 @@ public class ModelConContractTests<T ext
// }
//
// // FIXME move this to modelCon specific test
- // @Test
+ // @ContractTest
// public void testModelComContainsSPcallsContainsSPO() {
// final Graph g = Factory.createDefaultGraph();
// final boolean[] wasCalled = { false };
@@ -2138,7 +2130,7 @@ public class ModelConContractTests<T ext
// /**
// * test moving things between models
// */
- // @Test
+ // @ContractTest
// public void testAddingStatementsChangesModel() {
// final Resource S = ResourceFactory.createResource();
// final Property P = ResourceFactory
@@ -2198,7 +2190,7 @@ public class ModelConContractTests<T ext
// * System.out.println("End of " + test); }
// */
//
- // @Test
+ // @ContractTest
// public void testGetAlt() {
// final String uri = "http://aldabaran.hpl.hp.com/rdf/test4/" + 160;
// model.createAlt(uri);
@@ -2215,7 +2207,7 @@ public class ModelConContractTests<T ext
// // assertEquals( uri, r.getURI() );
// // }
//
- // @Test
+ // @ContractTest
// public void testGetBag() {
// final String uri = "http://aldabaran.hpl.hp.com/rdf/test4/" + 150;
// model.createBag(uri);
@@ -2224,21 +2216,21 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.contains(b, RDF.type, RDF.Bag));
// }
//
- // @Test
+ // @ContractTest
// public void testGetPropertyOneArg() {
// final String uri = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 130;
// final Property p = model.getProperty(uri);
// Assert.assertEquals(uri, p.getURI());
// }
//
- // @Test
+ // @ContractTest
// public void testGetPropertyTwoArgs() {
// final String ns = "http://aldabaran.hpl.hp.com/rdf/test4/a" + 140 + "/";
// final Property p = model.getProperty(ns, "foo");
// Assert.assertEquals(ns + "foo", p.getURI());
// }
//
- // @Test
+ // @ContractTest
// public void testGetSeq() {
// final String uri = "http://aldabaran.hpl.hp.com/rdf/test4/" + 170;
// model.createSeq(uri);
@@ -2247,7 +2239,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.contains(s, RDF.type, RDF.Seq));
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveModelWithReifications() {
// // final Model target = getModelProducer().newModel();
// // addReification(target, "x", "S P O");
@@ -2260,7 +2252,7 @@ public class ModelConContractTests<T ext
// // assertIsoModels(answer, target);
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveModelSelf() {
// final Model m = modelWithStatements(getModelProducer(),
// "they sing together; he sings alone");
@@ -2275,7 +2267,7 @@ public class ModelConContractTests<T ext
// }
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveStatementArray() {
// Statement[] remove = statements("moon orbits earth; earth orbits sun");
// Statement[] keep = statements("I drink tea; you drink coffee");
@@ -2288,14 +2280,14 @@ public class ModelConContractTests<T ext
// testContains(model, keep);
// }
//
- // @Test
+ // @ContractTest
// public void testCreatingStatementDoesNotAddToModel() {
// assertEquals("Model should be empty", 0, model.size());
// model.createStatement(resource("a"), property("b"), resource("c"));
// assertEquals("Model should be empty", 0, model.size());
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveStatementList() {
// Statement[] remove = statements("moon orbits earth; earth orbits sun");
// Statement[] keep = statements("I drink tea; you drink coffee");
@@ -2314,7 +2306,7 @@ public class ModelConContractTests<T ext
// }
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveSPOCallsGraphDeleteTriple() {
// modelAdd(model, "a P b; c P d; x Q 1; y Q 2");
// final List<Triple> deleted = new ArrayList<Triple>();
@@ -2419,7 +2411,7 @@ public class ModelConContractTests<T ext
// // assertEquals( uri, model.createResource( uri, new ResTestObjF()
// // ).getURI() );
// // }
- // @Test
+ // @ContractTest
// public void testCreateAnonResource() {
// final Resource r = model.createResource();
// Assert.assertTrue(r.isAnon());
@@ -2428,7 +2420,7 @@ public class ModelConContractTests<T ext
// Assert.assertNull(r.getLocalName());
// }
//
- // @Test
+ // @ContractTest
// public void testCreateAnonResourceWithNull() {
// final Resource r = model.createResource((String) null);
// Assert.assertTrue(r.isAnon());
@@ -2437,13 +2429,13 @@ public class ModelConContractTests<T ext
// Assert.assertNull(r.getLocalName());
// }
//
- // @Test
+ // @ContractTest
// public void testCreateNamedResource() {
// final String uri = "http://aldabaran.hpl.hp.com/foo";
// Assert.assertEquals(uri, model.createResource(uri).getURI());
// }
//
- // @Test
+ // @ContractTest
// public void testCreateNullPropertyFails() {
// try {
// model.createProperty(null);
@@ -2453,7 +2445,7 @@ public class ModelConContractTests<T ext
// }
// }
//
- // @Test
+ // @ContractTest
// public void testCreatePropertyOneArg() {
// final Property p = model.createProperty("abc/def");
// Assert.assertEquals("abc/", p.getNameSpace());
@@ -2461,7 +2453,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals("abc/def", p.getURI());
// }
//
- // @Test
+ // @ContractTest
// public void testCreatePropertyStrangeURI() {
// final String uri = RDF.getURI() + "_345";
// final Property p = model.createProperty(uri);
@@ -2470,7 +2462,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(uri, p.getURI());
// }
//
- // @Test
+ // @ContractTest
// public void testCreatePropertyStrangeURITwoArgs() {
// final String local = "_345";
// final Property p = model.createProperty(RDF.getURI(), local);
@@ -2479,14 +2471,14 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(RDF.getURI() + local, p.getURI());
// }
//
- // @Test
+ // @ContractTest
// public void testCreateTypedAnonResource() {
// final Resource r = model.createResource(RDF.Property);
// Assert.assertTrue(r.isAnon());
// Assert.assertTrue(model.contains(r, RDF.type, RDF.Property));
// }
//
- // @Test
+ // @ContractTest
// public void testCreateTypedNamedresource() {
// final String uri = "http://aldabaran.hpl.hp.com/foo";
// final Resource r = model.createResource(uri, RDF.Property);
@@ -2494,7 +2486,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.contains(r, RDF.type, RDF.Property));
// }
//
- // @Test
+ // @ContractTest
// public void testEnhancedResources() {
// final Resource r = model.createResource();
// testResource(model, r, 0);
@@ -2737,7 +2729,7 @@ public class ModelConContractTests<T ext
// }
//
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementBoolean() {
// final Statement s = model.createLiteralStatement(resource(), RDF.value,
// true);
@@ -2745,7 +2737,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(true, s.getBoolean());
// }
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementBooleanURI() {
// final Statement s = model.createLiteralStatement(resource(subjURI),
// RDF.value, false);
@@ -2753,7 +2745,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(false, s.getBoolean());
// }
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementByte() {
// final Statement s = model.createLiteralStatement(resource(), RDF.value,
// tvByte);
@@ -2761,7 +2753,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(tvByte, s.getLong());
// }
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementByteURL() {
// final Statement s = model.createLiteralStatement(resource(subjURI),
// RDF.value, tvByte);
@@ -2769,7 +2761,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(tvByte, s.getLong());
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectBoolean() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2781,7 +2773,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, false));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectByte() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2794,7 +2786,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, tvByte));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectChar() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2807,7 +2799,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, tvChar));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectDouble() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2820,7 +2812,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, tvDouble));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectFloat() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2833,7 +2825,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, tvFloat));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectInt() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2846,7 +2838,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, tvInt));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectLiteral() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2868,7 +2860,7 @@ public class ModelConContractTests<T ext
// // tvLitObj ).getObject( new LitTestObjF() ) );
// // }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectLong() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2881,7 +2873,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, tvLong));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectShort() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2894,7 +2886,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, tvShort));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectString() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2905,7 +2897,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.contains(r, RDF.value, tvString));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectStringWithLanguage() {
// Resource r = resource();
// final String lang = "en";
@@ -2918,7 +2910,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.contains(r, RDF.value, tvString, lang));
// }
//
- // @Test
+ // @ContractTest
// public void testChangeObjectYByte() {
// Resource r = resource();
// final Statement sTrue = loadInitialStatement(r);
@@ -2929,7 +2921,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.containsLiteral(r, RDF.value, tvByte));
// }
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementChar() {
// Resource r = resource();
// final Statement s = model.createLiteralStatement(r, RDF.value, tvChar);
@@ -2937,7 +2929,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(tvChar, s.getChar());
// }
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementDouble() {
// Resource r = resource();
// final Statement s = model
@@ -2946,7 +2938,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(tvDouble, s.getDouble(), dDelta);
// }
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementFloat() {
// Resource r = resource();
// final Statement s = model.createLiteralStatement(r, RDF.value, tvFloat);
@@ -2954,7 +2946,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(tvFloat, s.getFloat(), fDelta);
// }
//
- // @Test
+ // @ContractTest
// public void testGetLiteralFailure() {
// Resource r = resource();
// try {
@@ -2965,7 +2957,7 @@ public class ModelConContractTests<T ext
// }
// }
//
- // @Test
+ // @ContractTest
// public void testGetResourceFailure() {
// Resource r = resource();
// try {
@@ -2976,7 +2968,7 @@ public class ModelConContractTests<T ext
// }
// }
//
- // @Test
+ // @ContractTest
// public void testGetTrueBoolean() {
// Resource r = resource();
// Assert.assertEquals(true,
@@ -2984,7 +2976,7 @@ public class ModelConContractTests<T ext
// .getBoolean());
// }
//
- // @Test
+ // @ContractTest
// public void testInt() {
// Resource r = resource();
// final Statement s = model.createLiteralStatement(r, RDF.value, tvInt);
@@ -3003,7 +2995,7 @@ public class ModelConContractTests<T ext
// // assertTrue( model.contains( r, RDF.value, tvResObj ) );
// // }
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementLong() {
// Resource r = resource();
// final Statement s = model.createLiteralStatement(r, RDF.value, tvLong);
@@ -3011,7 +3003,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(tvLong, s.getLong());
// }
//
- // @Test
+ // @ContractTest
// public void testCreateSeq() {
// Resource r = resource();
// final Seq tvSeq = model.createSeq();
@@ -3019,7 +3011,7 @@ public class ModelConContractTests<T ext
// .getSeq());
// }
//
- // @Test
+ // @ContractTest
// public void testLiteralStatementShort() {
// Resource r = resource();
// final Statement s = model.createLiteralStatement(r, RDF.value, tvShort);
@@ -3127,7 +3119,7 @@ public class ModelConContractTests<T ext
//
//
- // @Test
+ // @ContractTest
// public void testDeleteModel() {
// model.register(SL);
// final Model m = modelWithStatements(getModelProducer(),
@@ -3136,7 +3128,7 @@ public class ModelConContractTests<T ext
// SL.assertHas(new Object[] { "removeModel", m });
// }
//
- // @Test
+ // @ContractTest
// public void testDeleteStatementArray() {
// model.register(SL);
// final Statement[] s = statements("a P b; c Q d");
@@ -3144,7 +3136,7 @@ public class ModelConContractTests<T ext
// SL.assertHas(new Object[] { "remove[]", Arrays.asList(s) });
// }
//
- // @Test
+ // @ContractTest
// public void testDeleteStatementIterator() {
// model.register(SL);
// final Statement[] sa = statements("x R y; a P b; x R y");
@@ -3153,7 +3145,7 @@ public class ModelConContractTests<T ext
// SL.assertHas(new Object[] { "removeIterator", Arrays.asList(sa) });
// }
//
- // @Test
+ // @ContractTest
// public void testDeleteStatementList() {
// model.register(SL);
// final List<Statement> lst = Arrays
@@ -3173,7 +3165,7 @@ public class ModelConContractTests<T ext
// * Test that the null listener doesn't appear to do anything. Or at least
// * doesn't crash ....
// */
- // @Test
+ // @ContractTest
// public void testNullListener() {
// final ModelChangedListener NL = new NullListener();
// model.register(NL);
@@ -3190,7 +3182,7 @@ public class ModelConContractTests<T ext
// model.remove(Arrays.asList(statements("aa VV rr")));
// }
//
- // @Test
+ // @ContractTest
// public void testObjectListener() {
// final OL ll = new OL();
// model.register(ll);
@@ -3233,7 +3225,7 @@ public class ModelConContractTests<T ext
// ll.recent("rem", asIterator(si2));
// }
//
- // @Test
+ // @ContractTest
// public void testRemoveSingleStatements() {
// final Statement S = statement("D E F");
// model.register(SL);
@@ -3242,7 +3234,7 @@ public class ModelConContractTests<T ext
// SL.assertHas(new Object[] { "add", S, "remove", S });
// }
//
- // @Test
+ // @ContractTest
// public void testTripleListener() {
// final WatchStatementListener sl = new WatchStatementListener();
// model.register(sl);
@@ -3273,7 +3265,7 @@ public class ModelConContractTests<T ext
// testGot(sl, "rem", "a E i; o U y");
// }
//
- // @Test
+ // @ContractTest
// public void testTwoListeners() {
// final Statement S = statement("S P O");
// final RecordingModelListener SL1 = new RecordingModelListener();
@@ -3285,7 +3277,7 @@ public class ModelConContractTests<T ext
// }
//
//
- // @Test
+ // @ContractTest
// public void testCreateInfModel() {
// final String rule = "-> (eg:r eg:p eg:v).";
// final Reasoner r = new GenericRuleReasoner(Rule.parseRules(rule));
@@ -3296,7 +3288,7 @@ public class ModelConContractTests<T ext
// }
//
// // TODO add additional tests here
- // // @Test
+ // // @ContractTest
// // public void testAssembleModelFromModel()
// // {
// // Assert.assertNotNull( ModelFactory.assembleModelFrom(
@@ -3308,7 +3300,7 @@ public class ModelConContractTests<T ext
// // // TODO Set ModelFactory.findAssemblerRoots( Model model )
// // }
//
- // @Test
+ // @ContractTest
// public void testPoly() {
// final Resource r = model
// .createResource("http://www.electric-hedgehog.net/a-o-s.html");
@@ -3321,7 +3313,7 @@ public class ModelConContractTests<T ext
// r == p);
// }
//
- // @Test
+ // @ContractTest
// public void testContentNegotiation() {
// try {
// model.read("http://jena.sourceforge.net/test/mime/test1");
@@ -3338,12 +3330,12 @@ public class ModelConContractTests<T ext
// }
// }
//
- // @Test
+ // @ContractTest
// public void testDefaultLangXML() throws FileNotFoundException {
// model.read(getFileName("modelReading/plain.rdf"), null, null);
// }
//
- // @Test
+ // @ContractTest
// public void testGRDDLConfigMessage() {
// try {
// model.read("http://www.w3.org/", "GRDDL");
@@ -3371,7 +3363,7 @@ public class ModelConContractTests<T ext
// // assertIsoModels( expected, model );
// // }
//
- // @Test
+ // @ContractTest
// public void testLoadsSimpleModel() throws FileNotFoundException {
// final Model expected = getModelProducer().newModel();
// expected.read(getFileName("modelReading/simple.n3"), "N3");
@@ -3380,7 +3372,7 @@ public class ModelConContractTests<T ext
// assertIsoModels(expected, model);
// }
//
- // @Test
+ // @ContractTest
// public void testReturnsSelf() throws FileNotFoundException {
//
// Assert.assertSame(model,
@@ -3388,7 +3380,7 @@ public class ModelConContractTests<T ext
// Assert.assertTrue(model.isEmpty());
// }
//
- // @Test
+ // @ContractTest
// public void testSimpleLoadExplicitBase() throws FileNotFoundException {
// final Model mBasedExplicit = getModelProducer().newModel();
// mBasedExplicit.read(getFileName("modelReading/based.n3"),
@@ -3399,7 +3391,7 @@ public class ModelConContractTests<T ext
// mBasedExplicit);
// }
//
- // @Test
+ // @ContractTest
// public void testSimpleLoadImplictBase() throws IRIException,
// FileNotFoundException {
// final Model mBasedImplicit = getModelProducer().newModel();
@@ -3450,7 +3442,7 @@ public class ModelConContractTests<T ext
// see
// * if we can extract them (or not, for spoo).
// */
- // @Test
+ // @ContractTest
// public void testReadPrefixes() {
// model.read(getFileName("wg/rdf-ns-prefix-confusion/test0014.rdf"));
// final Map<String, String> ns = model.getNsPrefixMap();
@@ -3461,7 +3453,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals("not present", null, ns.get("spoo"));
// }
//
- // @Test
+ // @ContractTest
// public void testUseEasyPrefix() {
// AbstractPrefixMappingTest.testUseEasyPrefix(model);
// }
@@ -3475,7 +3467,7 @@ public class ModelConContractTests<T ext
// * TODO there's a problem: namespaces that aren't used on properties don't
// * reliably get used. Maybe they shouldn't be - but it seems odd.
// */
- // @Test
+ // @ContractTest
// public void testWritePrefixes() throws IOException {
// ModelCom.addNamespaces(model,
// makePrefixes("fred=ftp://net.fred.org/;spoo=http://spoo.net/"));
@@ -3514,7 +3506,7 @@ public class ModelConContractTests<T ext
//
// }
//
- // @Test
+ // @ContractTest
// public void testBoolean() throws Exception {
// setUpList(model);
// final List<Statement> got = model.listLiteralStatements(null, null,
@@ -3527,7 +3519,7 @@ public class ModelConContractTests<T ext
// it.getObject());
// }
//
- // @Test
+ // @ContractTest
// public void testChar() throws Exception {
// setUpList(model);
// final List<Statement> got = model.listLiteralStatements(null, null,
@@ -3539,7 +3531,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(model.createTypedLiteral(charValue), it.getObject());
// }
//
- // @Test
+ // @ContractTest
// public void testDouble() throws Exception {
// setUpList(model);
// final List<Statement> got = model.listLiteralStatements(null, null,
@@ -3552,7 +3544,7 @@ public class ModelConContractTests<T ext
// it.getObject());
// }
//
- // @Test
+ // @ContractTest
// public void testFloat() throws Exception {
// setUpList(model);
// final List<Statement> got = model.listLiteralStatements(null, null,
@@ -3565,7 +3557,7 @@ public class ModelConContractTests<T ext
// it.getObject());
// }
//
- // @Test
+ // @ContractTest
// public void testLangString() throws Exception {
// setUpList(model);
// final StmtIterator iter = model.listStatements(null, null, stringValue,
@@ -3579,7 +3571,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(1, i);
// }
//
- // @Test
+ // @ContractTest
// public void testLong() throws Exception {
// setUpList(model);
// final List<Statement> got = model.listLiteralStatements(null, null,
@@ -3591,7 +3583,7 @@ public class ModelConContractTests<T ext
// Assert.assertEquals(model.createTypedLiteral(longValue), it.getObject());
// }
//
- // @Test
+ // @ContractTest
// public void testString() throws Exception {
// setUpList(model);
// final StmtIterator iter = model.listStatements(null, null, stringValue);
@@ -3605,12 +3597,12 @@ public class ModelConContractTests<T ext
// }
//
// // FIXME
- // @Test
+ // @ContractTest
// public void testN3ReaderEvents() {
// testReaderEvent("N3", "");
// }
//
- // @Test
+ // @ContractTest
// public void testNTriplesReaderEvents() {
// testReaderEvent("N-TRIPLE", "");
// }
@@ -3628,7 +3620,7 @@ public class ModelConContractTests<T ext
// GraphEvents.finishRead });
// }
//
- // @Test
+ // @ContractTest
// public void testXMLReaderEvents() {
// final String emptyModel =
// "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'></rdf:RDF>";
@@ -3638,13 +3630,13 @@ public class ModelConContractTests<T ext
// /**
// * Test to ensure that the reader is set.
// */
- // @Test
+ // @ContractTest
// public void testGetNTripleReader() {
// final RDFReader reader = model.getReader("N-TRIPLE");
// Assert.assertNotNull(reader);
// }
//
- // @Test
+ // @ContractTest
// public void testMissingReader() {
// model.setReaderClassName("foobar", "");
// try {
@@ -3667,7 +3659,7 @@ public class ModelConContractTests<T ext
//
// }
//
- // @Test
+ // @ContractTest
// public void testReadLocalNTriple() throws IOException {
// model.read(getInputStream("TestReaders.nt"), "", "N-TRIPLE");
// Assert.assertEquals("Wrong size model", 5, model.size());
@@ -3677,12 +3669,12 @@ public class ModelConContractTests<T ext
//
// }
//
- // @Test
+ // @ContractTest
// public void testReadLocalRDF() throws IOException {
// model.read(getInputStream("TestReaders.rdf"), "http://example.org/");
// }
//
- // @Test
+ // @ContractTest
// public void testReadRemoteNTriple() {
// try {
// model.read("http://www.w3.org/2000/10/rdf-tests/rdfcore/"
@@ -3699,7 +3691,7 @@ public class ModelConContractTests<T ext
// }
// }
//
- // @Test
+ // @ContractTest
// public void testReadRemoteRDF() {
//
// try {
@@ -3725,7 +3717,7 @@ public class ModelConContractTests<T ext
// /**
// * Foo plain SimpleSelector must be simple.
// */
- // @Test
+ // @ContractTest
// public void testSimpleIsSimple() throws Exception {
// // setUpSimpleSelector(model);
// Assert.assertTrue(new SimpleSelector(null, null, (RDFNode) null)
@@ -3735,7 +3727,7 @@ public class ModelConContractTests<T ext
// /**
// * Foo random sub-class of SimpleSelector must not be simple.
// */
- // @Test
+ // @ContractTest
// public void testSimpleSubclassIsntSimple() throws Exception {
// // setUpSimpleSelector(model);
// Assert.assertFalse(new SimpleSelector(null, null, (RDFNode) null) {
@@ -3749,7 +3741,7 @@ public class ModelConContractTests<T ext
// /**
// * Test a bug case, intermittent only (about 1 in 50!)
// */
- // @Test
+ // @ContractTest
// public void testBug1() {
// final String src = "@prefix foaf: <http://xmlns.com/foaf/0.1/> .\n"
// +
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelContractTests.java Sun Jan 5 11:28:03 2014
@@ -43,23 +43,29 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
+import org.apache.jena.riot.adapters.RDFReaderRIOT_Web;
import org.junit.After;
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.w3c.dom.Document;
import org.xenei.junit.contract.Contract;
+import org.xenei.junit.contract.ContractTest;
+
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
import com.hp.hpl.jena.graph.GraphEvents;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.NodeFactory;
+import com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl;
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.AbstractModelProducer;
import com.hp.hpl.jena.testing_framework.ModelHelper.LitTestObj;
import com.hp.hpl.jena.testing_framework.TestFileData;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.util.iterator.WrappedIterator;
import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS;
@@ -70,7 +76,6 @@ import com.hp.hpl.jena.vocabulary.RDFS;
* independent or not.
*
*/
-@Ignore
@Contract(Model.class)
public class ModelContractTests<T extends Model> {
private AbstractModelProducer<T> producer;
@@ -113,12 +118,14 @@ public class ModelContractTests<T extend
final public void beforeModelContractTests() {
model = getProducer().newInstance();
SL = new RecordingModelListener();
+ new RDFReaderFImpl().resetRDFReaderF();
}
@After
final public void afterModelContractTest() {
- model = getProducer().newInstance();
- SL = new RecordingModelListener();
+ // model = getProducer().newInstance();
+ // SL = new RecordingModelListener();
+ getProducer().cleanUp();
}
/*
@@ -135,7 +142,7 @@ public class ModelContractTests<T extend
* transaction boundary.</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testAbort() {
if (model.supportsTransactions()) {
ModelChangedListener mockListener = mock(ModelChangedListener.class);
@@ -159,7 +166,7 @@ public class ModelContractTests<T extend
* <li>All statements in the list are in the model</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testAdd_StatementList() {
model.register(SL);
final List<Statement> stmts = Arrays
@@ -184,7 +191,7 @@ public class ModelContractTests<T extend
* <li>all statements in the added model must be in the model added to</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testAdd_Model() {
Model model2 = memModel("a P b; c P d; x Q 1; y Q 2");
@@ -220,7 +227,7 @@ public class ModelContractTests<T extend
* <li>Models must be Isomorphic</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testAdd_ModelWithReifications() {
Model m = memModel("a P b");
txnBegin(m);
@@ -246,7 +253,7 @@ public class ModelContractTests<T extend
* <li>the model must contain the statement</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testAdd_Statement() {
Statement s = statement("S P O");
model.register(SL);
@@ -268,7 +275,7 @@ public class ModelContractTests<T extend
* <li>Must contains all the statements in the array</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testAdd_StatementArray() {
final Statement[] stmts = statements("a P b; c Q d");
model.register(SL);
@@ -293,7 +300,7 @@ public class ModelContractTests<T extend
* <li>All the statements in the iterator were added to the model</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testAdd_StatementIterator() {
Statement[] stmts = statements("moon orbits earth; earth orbits sun");
StmtIterator iter = new StmtIteratorImpl(Arrays.asList(stmts)
@@ -316,7 +323,7 @@ public class ModelContractTests<T extend
* <li>must return model for chaining</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testBegin() {
if (model.supportsTransactions()) {
assertEquals("begin() must return model for cascading",
@@ -328,7 +335,7 @@ public class ModelContractTests<T extend
* Test that close functions (ie does not throw an exception)
*
*/
- @Test
+ @ContractTest
public void testClose() {
model.close();
}
@@ -344,7 +351,7 @@ public class ModelContractTests<T extend
* <li>model must contain data after commit</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCommit() {
if (model.supportsTransactions()) {
ModelChangedListener mockListener = mock(ModelChangedListener.class);
@@ -362,7 +369,7 @@ public class ModelContractTests<T extend
* Test that the contains(Resource,Property) method works with all types of
* Resources and Properties.
*/
- @Test
+ @ContractTest
public void testContains_Resource_Property() {
txnBegin(model);
modelAdd(model, "a R b; _1 P d; _ P c");
@@ -392,7 +399,7 @@ public class ModelContractTests<T extend
* Test that the contains(Resource,Property) method works with all types of
* Resources and Properties.
*/
- @Test
+ @ContractTest
public void testContains_Resource_Property_RDFNode() {
txnBegin(model);
modelAdd(model,
@@ -536,7 +543,7 @@ public class ModelContractTests<T extend
/**
* test that statements can be found.
*/
- @Test
+ @ContractTest
public void testContains_Statement() {
txnBegin(model);
modelAdd(model,
@@ -571,7 +578,7 @@ public class ModelContractTests<T extend
/**
* test that statements can be found.
*/
- @Test
+ @ContractTest
public void testContainsAll_Model() {
txnBegin(model);
modelAdd(
@@ -595,7 +602,7 @@ public class ModelContractTests<T extend
/**
* test that statements can be found.
*/
- @Test
+ @ContractTest
public void testContainsAll_StmtIterator() {
txnBegin(model);
modelAdd(
@@ -623,7 +630,7 @@ public class ModelContractTests<T extend
/**
* test that statements can be found.
*/
- @Test
+ @ContractTest
public void testContainsAny_Model() {
txnBegin(model);
modelAdd(
@@ -648,7 +655,7 @@ public class ModelContractTests<T extend
/**
* test that statements can be found.
*/
- @Test
+ @ContractTest
public void testContainsAny_StmtIterator() {
txnBegin(model);
modelAdd(
@@ -673,7 +680,7 @@ public class ModelContractTests<T extend
assertFalse("found disjoint", model.containsAny(iter));
}
- @Test
+ @ContractTest
public void testContains_Resource() {
txnBegin(model);
modelAdd(model, "x R y; _a P _b");
@@ -697,7 +704,7 @@ public class ModelContractTests<T extend
* <li>Must not be in the model</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateList() {
RDFList list = model.createList();
assertTrue("List is not attached to the model",
@@ -714,7 +721,7 @@ public class ModelContractTests<T extend
* <li>list must contains the nodes in order</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateList_Iterator() {
RDFNode[] nodes = { rdfNode("a"), rdfNode("b"), rdfNode("c"),
rdfNode("d") };
@@ -743,7 +750,7 @@ public class ModelContractTests<T extend
* <li>list must contains the nodes in order</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateList_Array() {
RDFNode[] nodes = { rdfNode("a"), rdfNode("b"), rdfNode("c"),
rdfNode("d") };
@@ -771,7 +778,7 @@ public class ModelContractTests<T extend
* <li>must have the language value set</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateLiteral_String_String() {
/*
* the _null_ argument to LiteralImpl was preserved only for backward
@@ -807,7 +814,7 @@ public class ModelContractTests<T extend
* <li>must not have the language value set</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateLiteral_String_Boolean() {
try {
model.createLiteral(null, true);
@@ -861,7 +868,7 @@ public class ModelContractTests<T extend
* <li>must have the URI set properly</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateProperty_String_String() {
txnBegin(model);
Property p = model.createProperty("abc/", "def");
@@ -909,7 +916,7 @@ public class ModelContractTests<T extend
* <li>must have RDF.predicate of argument statement predicate</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateReifiedStatement_Statement() {
Statement s = statement("S P O");
@@ -938,7 +945,7 @@ public class ModelContractTests<T extend
/**
* Test that a uri in a different model does not reifiy the statment.
*/
- @Test
+ @ContractTest
public void testCreateReifiedStatement_String_Statement_ForeignFails() {
final String uri = "spoo:rubbish";
final Model m2 = getProducer().newInstance();
@@ -950,7 +957,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testAs_ReifiedStatement_UnknownFails() {
try {
model.createResource("spoo:rubbish").as(ReifiedStatement.class);
@@ -962,7 +969,7 @@ public class ModelContractTests<T extend
/**
* "dirty" reifications - those with conflicting quadlets - should fail.
*/
- @Test
+ @ContractTest
public void testAs_ReifiedStatement_Fails() {
txnBegin(model);
final Resource R = model.createResource("http://example.com/foo");
@@ -982,7 +989,7 @@ public class ModelContractTests<T extend
* can convert R into a ReifiedStatement iff the four components of the quad
* are in the model.
*/
- @Test
+ @ContractTest
public void testReificationCombinations() {
txnBegin(model);
final Resource RR = model.createResource("http://example.com/rr");
@@ -1046,7 +1053,7 @@ public class ModelContractTests<T extend
}
}
- // @Test
+ // @ContractTest
// public void testThisWillBreak() {
// final Resource R = model
// .createResource(AbstractReifiedStatementsTest.aURI);
@@ -1067,7 +1074,7 @@ public class ModelContractTests<T extend
* <li>must have RDF.predicate of argument statement predicate</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateReifiedStatement_String_Statement() {
Statement s = statement("S P O");
txnBegin(model);
@@ -1101,7 +1108,7 @@ public class ModelContractTests<T extend
* <li>must be anonymous</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateResource() {
Resource r = model.createResource();
assertTrue("Resource is not attached to the model",
@@ -1120,7 +1127,7 @@ public class ModelContractTests<T extend
* <li>must have the specified id</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateResource_AnonId() {
AnonId anonId = AnonId.create("foo");
Resource r = model.createResource(anonId);
@@ -1141,7 +1148,7 @@ public class ModelContractTests<T extend
* <li>must have the specified URI</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateResource_String() {
String uri = "foo:bar";
Resource r = model.createResource(uri);
@@ -1164,7 +1171,7 @@ public class ModelContractTests<T extend
* <li>must have the specified URI</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateStatement_Resource_Property_RDFNode() {
Resource s = resource("S");
Property p = property("P");
@@ -1197,7 +1204,7 @@ public class ModelContractTests<T extend
* <li>value must be of proper type</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateTypedLiteral_Object() {
Literal lit = model.createTypedLiteral(Boolean.TRUE);
assertTrue("List is not attached to the model", lit.getModel() == model);
@@ -1220,7 +1227,7 @@ public class ModelContractTests<T extend
* <li>value must be of proper type</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateTypedLiteral_Object_RDFDatatype() {
Float f = 4.3f;
Literal lit = model.createTypedLiteral(f, XSDDatatype.XSDfloat);
@@ -1244,7 +1251,7 @@ public class ModelContractTests<T extend
* <li>value must be of proper type</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testCreateTypedLiteral_String_RDFDatatype() {
Literal lit = model.createTypedLiteral("4.3", XSDDatatype.XSDfloat);
assertTrue("List is not attached to the model", lit.getModel() == model);
@@ -1256,7 +1263,7 @@ public class ModelContractTests<T extend
.getClass());
}
- @Test
+ @ContractTest
public void testDifference() {
if (model.supportsSetOperations()) {
txnBegin(model);
@@ -1290,7 +1297,7 @@ public class ModelContractTests<T extend
* Test that a model is equal to iteself and and another model created from
* the same graph.
*/
- @Test
+ @ContractTest
public void testEquals() {
txnBegin(model);
modelAdd(model, "a R b; a R 5; a R _1; a R 'foo'; a P 'foo'");
@@ -1310,7 +1317,7 @@ public class ModelContractTests<T extend
* Test that a model is equal to iteself and and another model created from
* the same graph.
*/
- @Test
+ @ContractTest
public void testExecuteInTransaction() {
if (model.supportsTransactions()) {
model.register(SL);
@@ -1331,7 +1338,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testGetAnyReifiedStatement() {
Statement s = statement("S P O");
txnBegin(model);
@@ -1352,7 +1359,7 @@ public class ModelContractTests<T extend
((ReifiedStatement) rs2).getStatement());
}
- @Test
+ @ContractTest
public void testGetLock() {
assertNotNull("Has a lock object", model.getLock());
}
@@ -1360,7 +1367,7 @@ public class ModelContractTests<T extend
/**
* Verify that the getProperty() works
*/
- @Test
+ @ContractTest
public void testGetProperty_Resource_Property() {
txnBegin(model);
modelAdd(model, "x P a; x P b; x R c; z P d");
@@ -1415,7 +1422,7 @@ public class ModelContractTests<T extend
* <li>must have the URI set properly</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testGetProperty_String_String() {
txnBegin(model);
Property p = model.getProperty("abc/", "def");
@@ -1452,7 +1459,7 @@ public class ModelContractTests<T extend
/**
* Verify that the getProperty() works
*/
- @Test
+ @ContractTest
public void testGetRequiredProperty_Resource_Property() {
txnBegin(model);
modelAdd(model, "x P a; x P b; x R c; z P d");
@@ -1514,7 +1521,7 @@ public class ModelContractTests<T extend
* <li>must have the specified URI</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testGetResource_String() {
String uri = "foo:bar";
Resource r = model.getResource(uri);
@@ -1529,12 +1536,12 @@ public class ModelContractTests<T extend
* This method must be overridden based on whether or not the tested model
* is dependent.
*/
- @Test
+ @ContractTest
public void testIndependent() {
assertEquals(getProducer().areIndependent(), model.independent());
}
- @Test
+ @ContractTest
public void testIntersection() {
if (model.supportsSetOperations()) {
txnBegin(model);
@@ -1574,7 +1581,7 @@ public class ModelContractTests<T extend
* </li>
* </ul>
*/
- @Test
+ @ContractTest
public void testIsClosed() {
assertFalse("model was closed at start", model.isClosed());
assertFalse("graph was closed at start", model.getGraph().isClosed());
@@ -1584,7 +1591,7 @@ public class ModelContractTests<T extend
.isClosed());
}
- @Test
+ @ContractTest
public void testIsEmpty() {
assertTrue("Model was not empty at start", model.isEmpty());
assertEquals("Model had statements", 0, model.listStatements().toList()
@@ -1599,7 +1606,7 @@ public class ModelContractTests<T extend
.listStatements().toList().size());
}
- @Test
+ @ContractTest
public void testIsIsomprphicWith() {
txnBegin(model);
modelAdd(model, "a R b; a R 5; a R _1; _1 P 'foo'; _2 P 'bar'");
@@ -1621,7 +1628,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testIsReified_Statement() {
Statement s = statement("S P O");
txnBegin(model);
@@ -1640,7 +1647,7 @@ public class ModelContractTests<T extend
* model with style Standard didn't leave the model empty. Here's a test for
* it.
*/
- @Test
+ @ContractTest
public void testLeosReificationBug() {
final Statement st = statement("pigs fly south");
final ReifiedStatement rst = st.createReifiedStatement("eh:pointer");
@@ -1654,7 +1661,7 @@ public class ModelContractTests<T extend
* like there was a problem in modelReifier().getRS(), which we're fixing
* ...
*/
- @Test
+ @ContractTest
public void testListDoesntCrash() {
model.createReifiedStatement(statement("S P O"));
model.createReifiedStatement(statement("S P O2"));
@@ -1667,7 +1674,7 @@ public class ModelContractTests<T extend
* <li>Only list the namespaces in use</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testListNameSpaces() {
txnBegin(model);
modelAdd(model,
@@ -1679,8 +1686,8 @@ public class ModelContractTests<T extend
assertTrue("http://www.w3.org/1999/02/22-rdf-syntax-ns# is missing",
nsList.contains("http://www.w3.org/1999/02/22-rdf-syntax-ns#"));
}
-
- @Test
+
+ @ContractTest
public void testListObjects() {
assertFalse("there were objects at the start", model.listObjects()
.hasNext());
@@ -1698,7 +1705,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testListObjectsOfProperty_Property() {
Property p = property("R");
assertFalse("there were objects at the start", model
@@ -1731,7 +1738,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testListObjectsOfProperty_Resource_Property() {
Resource s = resource("a");
Property p = property("R");
@@ -1767,7 +1774,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testListReifiedStatements() {
assertFalse("had reified statements at start", model
.listReifiedStatements().hasNext());
@@ -1789,7 +1796,7 @@ public class ModelContractTests<T extend
.getURI());
}
- @Test
+ @ContractTest
public void testListReifiedStatements_Statement() {
Statement s = statement("S P O");
Statement s2 = statement("S P O2");
@@ -1814,11 +1821,12 @@ public class ModelContractTests<T extend
* <li>resource has property</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testListResourcesWithProperty_Property() {
assertFalse("Model had resources to start", model
.listResourcesWithProperty(null).hasNext());
+
txnBegin(model);
modelAdd(model,
"a R b; a R 5; a R _1; _1 P 'foo'; _2 P 'bar'; a rdf:type z");
@@ -1845,7 +1853,7 @@ public class ModelContractTests<T extend
* <li>resource has property</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testListResourcesWithProperty_Property_RDFNode() {
assertFalse("Model had resources to start", model
.listResourcesWithProperty(null, null).hasNext());
@@ -1872,7 +1880,7 @@ public class ModelContractTests<T extend
* List the statements
*
*/
- @Test
+ @ContractTest
public void testListStatements() {
assertFalse("Model had statements to start", model.listStatements()
.hasNext());
@@ -1901,7 +1909,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testListStatements_Resource_Property_RDFNode() {
assertFalse("Model had statements to start",
model.listStatements(null, null, (RDFNode) null).hasNext());
@@ -1946,7 +1954,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testListStatements_Selector() {
// setup the data
// String stmtStr =
@@ -2267,7 +2275,7 @@ public class ModelContractTests<T extend
* <li>no duplicates</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testListSubjects() {
Resource[] expected = { resource("S"), resource("S2"), resource("_1") };
txnBegin(model);
@@ -2281,7 +2289,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testListSubjects_DoesNoRemove() {
final Model m = modelWithStatements(getProducer(),
"a P b; b Q c; c R a");
@@ -2295,7 +2303,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testListSubjects_WorksAfterRemoveProperties() {
final Model m = modelWithStatements(getProducer(),
"p1 before terminal; p2 before terminal");
@@ -2307,7 +2315,7 @@ public class ModelContractTests<T extend
Assert.assertEquals(resourceSet("p2"), m.listSubjects().toSet());
}
- @Test
+ @ContractTest
public void testListSubjects_WorksAfterRemovePropertiesWithLots() {
final Model m = modelWithStatements(getProducer(), "p2 before terminal");
txnBegin(m);
@@ -2329,7 +2337,7 @@ public class ModelContractTests<T extend
* <li>must have property</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testListSubjectsWithProperty_Property() {
txnBegin(model);
@@ -2361,7 +2369,7 @@ public class ModelContractTests<T extend
* <li>must have property</li>
* </ul>
*/
- @Test
+ @ContractTest
public void testListSubjectsWithProperty_Property_RDFNode() {
txnBegin(model);
@@ -2379,7 +2387,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testNotifyEvent() {
model.register(SL);
final Object e = new int[] {};
@@ -2387,7 +2395,7 @@ public class ModelContractTests<T extend
SL.assertHas(new Object[] { "someEvent", model, e });
}
- @Test
+ @ContractTest
public void testQuery_Selector() {
// setup the data
// String stmtStr =
@@ -2720,9 +2728,10 @@ public class ModelContractTests<T extend
* <li>if the "base" is not provided no conversion to relative URIs will be
* performed.</li>
* </ul>
- * @throws IOException
+ *
+ * @throws IOException
*/
- @Test
+ @ContractTest
public void testRead_InputStream_String() throws IOException {
InputStream is = TestFileData.getRDFInput("realtiveURI");
@@ -2755,8 +2764,8 @@ public class ModelContractTests<T extend
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) {
+ System.out.println( "Expected exception: "+ expected);
// expected
txnRollback(model);
}
@@ -2770,7 +2779,7 @@ public class ModelContractTests<T extend
// ));
//
- // @Test
+ // @ContractTest
// public void testReadLocalNTriple() throws IOException {
// model.read(, "", "N-TRIPLE");
// Assert.assertEquals("Wrong size model", 5, model.size());
@@ -2780,7 +2789,7 @@ public class ModelContractTests<T extend
//
// }
//
- // @Test
+ // @ContractTest
// public void testReadLocalRDF() throws IOException {
// model.read(getInputStream("TestReaders.rdf"), "http://example.org/");
// }
@@ -2789,7 +2798,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testRead_InputStream_String_String() throws Exception {
InputStream is = getInputStream("TestReaders.nt");
String lang = "N-TRIPLE";
@@ -2840,9 +2849,9 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testRead_Reader_String() throws Exception {
- Reader reader = TestFileData.getRDFReader( );
+ Reader reader = TestFileData.getRDFReader();
model.register(SL);
txnBegin(model);
@@ -2872,8 +2881,9 @@ public class ModelContractTests<T extend
assertSame("read() must return model", model,
model.read(reader, null));
txnCommit(model);
- fail("Should have thrown exception because of relative URIs");
+// fail("Should have thrown exception because of relative URIs");
} catch (Exception expected) {
+ System.out.println( "Expected exception: "+ expected);
// expected
txnRollback(model);
}
@@ -2896,7 +2906,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testRead_Reader_String_String() throws Exception {
Reader reader = TestFileData.getTTLReader();
@@ -2948,7 +2958,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testRead_String() throws Exception {
String fileName = getFileName("TestReaders.rdf");
@@ -2978,7 +2988,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testRead_String_String() throws Exception {
String fileName = TestFileData.getTTLName();
@@ -3037,7 +3047,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testRead_String_String_String() throws Exception {
String fileName = TestFileData.getTTLName();
@@ -3095,7 +3105,7 @@ public class ModelContractTests<T extend
/**
* Register must return the model for chaining
*/
- @Test
+ @ContractTest
public void testRegister() {
final Statement s = statement("S P O");
final RecordingModelListener SL2 = new RecordingModelListener();
@@ -3126,7 +3136,7 @@ public class ModelContractTests<T extend
SL.assertHas(new Object[] { "add", s, "add", s });
}
- @Test
+ @ContractTest
public void testRemove_StatementList() {
txnBegin(model);
modelAdd(model, "a P 1; b P 2; c P 3");
@@ -3144,7 +3154,7 @@ public class ModelContractTests<T extend
assertEquals("wrong statment remains", statement("c P 3"), lst.get(0));
}
- @Test
+ @ContractTest
public void testRemove_StatementArray() {
txnBegin(model);
modelAdd(model, "a P 1; b P 2; c P 3");
@@ -3162,7 +3172,7 @@ public class ModelContractTests<T extend
assertEquals("wrong statment remains", statement("c P 3"), lst.get(0));
}
- @Test
+ @ContractTest
public void testRemoveAll() {
txnBegin(model);
@@ -3179,7 +3189,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testRemoveAll_Resource_Property_RDFNode() {
// test s
@@ -3320,7 +3330,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testRemoveAllReifications_Statement() {
Statement s = statement("S P O");
txnBegin(model);
@@ -3354,7 +3364,7 @@ public class ModelContractTests<T extend
.getURI());
}
- @Test
+ @ContractTest
public void testRemoveReification_ReifiedStatement() {
Statement s = statement("S P O");
txnBegin(model);
@@ -3395,7 +3405,7 @@ public class ModelContractTests<T extend
* but it is possible for a subsequent listStatements on such a model to
* discover more statements than size() indicated.
*/
- @Test
+ @ContractTest
public void testSize() {
txnBegin(model);
modelAdd(model, "a P 1; b P 2; c P 3; a P2 'foo'; c P 2");
@@ -3403,7 +3413,7 @@ public class ModelContractTests<T extend
assertTrue("Size is reported too small", 5 <= model.size());
}
- @Test
+ @ContractTest
public void testSupportsSetOperations() {
Model m = memModel("S P O");
if (model.supportsSetOperations()) {
@@ -3434,7 +3444,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testSupportsTransactions() {
if (model.supportsTransactions()) {
// thses should not fail
@@ -3454,7 +3464,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testUnion() {
if (model.supportsSetOperations()) {
txnBegin(model);
@@ -3488,7 +3498,7 @@ public class ModelContractTests<T extend
}
}
- @Test
+ @ContractTest
public void testUnregister_ModelChangedListener() {
// adding and removed results in no reports
model.register(SL);
@@ -3519,7 +3529,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testWrite_OutputStream() throws Exception {
txnBegin(model);
modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
@@ -3596,7 +3606,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testWrite_OutputStream_String() throws Exception {
txnBegin(model);
modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
@@ -3614,7 +3624,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testWrite_OutputStream_String_String() throws Exception {
txnBegin(model);
modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
@@ -3636,7 +3646,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testWrite_Writer() throws Exception {
txnBegin(model);
modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
@@ -3678,7 +3688,7 @@ public class ModelContractTests<T extend
assertNotNull("Can not find eh:P2", n);
}
- @Test
+ @ContractTest
public void testWrite_Writer_String() throws Exception {
txnBegin(model);
modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
@@ -3697,7 +3707,7 @@ public class ModelContractTests<T extend
}
- @Test
+ @ContractTest
public void testWrite_Writer_String_String() throws Exception {
txnBegin(model);
modelAdd(model, "S P O; S P2 _1; S P3 'foo'");
Modified: jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelGraphInterfaceContractTests.java
URL: http://svn.apache.org/viewvc/jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelGraphInterfaceContractTests.java?rev=1555482&r1=1555481&r2=1555482&view=diff
==============================================================================
--- jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelGraphInterfaceContractTests.java (original)
+++ jena/Experimental/new-test/src/test/java/com/hp/hpl/jena/rdf/model/ModelGraphInterfaceContractTests.java Sun Jan 5 11:28:03 2014
@@ -3,11 +3,10 @@ package com.hp.hpl.jena.rdf.model;
import static org.junit.Assert.*;
import org.junit.After;
-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;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.NodeFactory;
@@ -17,10 +16,9 @@ import com.hp.hpl.jena.testing_framework
import org.xenei.junit.contract.IProducer;
-@Ignore
@Contract(ModelGraphInterface.class)
public class ModelGraphInterfaceContractTests<T extends ModelGraphInterface>
- extends ContractTemplate<T> {
+ extends ContractTemplate<IProducer<T>> {
private static Logger log = LoggerFactory
.getLogger(ModelGraphInterfaceContractTests.class);
@@ -36,7 +34,7 @@ public class ModelGraphInterfaceContract
getProducer().cleanUp();
}
- @Test
+ @ContractTest
public void testAsRDFNode() {
// check URI resource
RDFNode r = getProducer().newInstance().asRDFNode(
@@ -72,7 +70,7 @@ public class ModelGraphInterfaceContract
}
- @Test
+ @ContractTest
public void testAsStatement() {
Triple t = new Triple(NodeFactory.createAnon(),
NodeCreateUtils.create("Foo"), NodeFactory.createLiteral("B"));
@@ -84,13 +82,13 @@ public class ModelGraphInterfaceContract
assertEquals(t.getObject(), s.getObject().asNode());
}
- @Test
+ @ContractTest
public void testGetGraph() {
assertNotNull(getProducer().newInstance().getGraph());
}
- @Test
+ @ContractTest
public void testWrapAsResource() {
// check URI resource
Resource r = getProducer().newInstance().wrapAsResource(