1 5 6 package com.hp.hpl.jena.rdf.model.test; 7 8 import com.hp.hpl.jena.graph.test.GraphTestBase; 9 import com.hp.hpl.jena.rdf.model.*; 10 import junit.framework.*; 11 12 public class TestModelPolymorphism extends GraphTestBase 13 { 14 public static TestSuite suite() 15 { return new TestSuite( TestModelPolymorphism.class ); } 16 17 public TestModelPolymorphism(String name) 18 { 19 super(name); 20 } 21 22 public void testPoly() 23 { 24 Model m = ModelFactory.createDefaultModel(); 25 Resource r = m.createResource( "http://www.electric-hedgehog.net/a-o-s.html" ); 26 assertFalse( "the Resouce should not be null", r == null ); 27 assertTrue( "the Resource can be a Property", r.canAs( Property.class ) ); 28 Property p = (Property) r.as( Property.class ); 29 assertFalse( "the Property should not be null", p == null ); 30 assertFalse( "the Resource and Property should not be identical", r == p ); 31 } 32 } 33 34 35 61 | Popular Tags |