📄 exotictest.java
字号:
assertTrue( "repository should have statement (someCubist, rdf:type, Cubist)", _repository.hasStatement(newCubist, URIImpl.RDF_TYPE, CUBIST)); assertTrue( "repository should have statement (someCubist, rdf:type, Artist)", _repository.hasStatement(newCubist, URIImpl.RDF_TYPE, ARTIST)); } public void testRemoveStatement() { int result = 0; try { _repository.startTransaction(); result = _repository.removeStatements(PICASSO, null, GUERNICA); _repository.commitTransaction(); } catch (SailUpdateException e) { fail("Unable to remove statement: " + e.getMessage()); } // one (explicit) statement should have been removed: // (picasso, paints, guernica) assertEquals( "The number of removed statements should be 1", 1, result); // no statements relating picasso to guernica should remain. assertFalse( "repository should not have statement (Picasso, paints, Guernica)", _repository.hasStatement(PICASSO, PAINTS, GUERNICA)); assertFalse( "repository should not have statement (Picasso, creates, Guernica)", _repository.hasStatement(PICASSO, CREATES, GUERNICA)); assertFalse( "repository should not have statements matching (Picasso, null, Guernica)", _repository.hasStatement(PICASSO, null, GUERNICA)); } */ class IsClassTest extends TestCase { private Resource _resource; private boolean _positive; public IsClassTest(Resource resource, boolean positive) { super(resource + " is " + (positive?"":"not ") + "a class"); _resource = resource; _positive = positive; } protected void runTest() { if (_positive) { assertTrue( _resource.toString() + " should be a class", _repository.isClass(_resource)); } else { assertFalse( _resource.toString() + " should not be a class", _repository.isClass(_resource)); } } } class IsPropertyTest extends TestCase { private Resource _resource; private boolean _positive; public IsPropertyTest(Resource resource, boolean positive) { super(resource + " is " + (positive?"":"not ") + "a property"); _resource = resource; _positive = positive; } protected void runTest() { if (_positive) { assertTrue( _resource.toString() + " should be a property", _repository.isProperty(_resource)); } else { assertFalse( _resource.toString() + " should not be a property", _repository.isProperty(_resource)); } } } class IsSubClassOfTest extends TestCase { private Resource _sub; private Resource _super; private boolean _positive; public IsSubClassOfTest( Resource subClass, Resource superClass, boolean positive) { super(subClass + " is " + (positive?"":"not ") + "a subclass of " + superClass); _sub = subClass; _super = superClass; _positive = positive; } protected void runTest() { if (_positive) { assertTrue( _sub.toString() + " should be a subclass of " + _super.toString(), _repository.isSubClassOf(_sub, _super)); } else { assertFalse( _sub.toString() + " should not be a subclass of " + _super.toString(), _repository.isSubClassOf(_sub, _super)); } } } class IsDirectSubClassOfTest extends TestCase { private Resource _sub; private Resource _super; private boolean _positive; public IsDirectSubClassOfTest( Resource subClass, Resource superClass, boolean positive) { super(subClass + " is " + (positive?"":"not ") + "a direct subclass of " + superClass); _sub = subClass; _super = superClass; _positive = positive; } protected void runTest() { if (_positive) { assertTrue( _sub.toString() + " should be a direct subclass of " + _super.toString(), _repository.isDirectSubClassOf(_sub, _super)); } else { assertFalse( _sub.toString() + " should not be a direct subclass of " + _super.toString(), _repository.isDirectSubClassOf(_sub, _super)); } } } class IsSubPropertyOfTest extends TestCase { private Resource _sub; private Resource _super; private boolean _positive; public IsSubPropertyOfTest( Resource subProperty, Resource superProperty, boolean positive) { super(subProperty + " is " + (positive?"":"not ") + "a subproperty of " + superProperty); _sub = subProperty; _super = superProperty; _positive = positive; } protected void runTest() { if (_positive) { assertTrue( _sub.toString() + " should be a subproperty of " + _super.toString(), _repository.isSubPropertyOf(_sub, _super)); } else { assertFalse( _sub.toString() + " should not be a subproperty of " + _super.toString(), _repository.isSubPropertyOf(_sub, _super)); } } } class IsDirectSubPropertyOfTest extends TestCase { private Resource _sub; private Resource _super; private boolean _positive; public IsDirectSubPropertyOfTest( Resource subProperty, Resource superProperty, boolean positive) { super(subProperty + " is " + (positive?"":"not ") + "a direct subproperty of " + superProperty); _sub = subProperty; _super = superProperty; _positive = positive; } protected void runTest() { if (_positive) { assertTrue( _sub.toString() + " should be a direct subproperty of " + _super.toString(), _repository.isDirectSubPropertyOf(_sub, _super)); } else { assertFalse( _sub.toString() + " should not be a direct subproperty of " + _super.toString(), _repository.isDirectSubPropertyOf(_sub, _super)); } } } class IsTypeTest extends TestCase { private Resource _inst; private Resource _clazz; private boolean _positive; public IsTypeTest( Resource inst, Resource clazz, boolean positive) { super(inst + " is " + (positive?"":"not ") + "an instance of " + clazz); _inst = inst; _clazz = clazz; _positive = positive; } protected void runTest() { if (_positive) { assertTrue( _inst.toString() + " should be an instance of " + _clazz.toString(), _repository.isType(_inst, _clazz)); } else { assertFalse( _inst.toString() + " should not be an instance of " + _clazz.toString(), _repository.isType(_inst, _clazz)); } } } class IsDirectTypeTest extends TestCase { private Resource _inst; private Resource _clazz; private boolean _positive; public IsDirectTypeTest( Resource inst, Resource clazz, boolean positive) { super(inst + " is " + (positive?"":"not ") + "a direct instance of " + clazz); _inst = inst; _clazz = clazz; _positive = positive; } protected void runTest() { if (_positive) { assertTrue( _inst.toString() + " should be a direct instance of " + _clazz.toString(), _repository.isDirectType(_inst, _clazz)); } else { assertFalse( _inst.toString() + " should not be a direct instance of " + _clazz.toString(), _repository.isDirectType(_inst, _clazz)); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -