1 7 package com.hp.hpl.jena.xmloutput.test; 8 9 import java.io.StringWriter ; 12 13 import com.hp.hpl.jena.rdf.model.*; 14 import com.hp.hpl.jena.shared.BadURIException; 15 16 import junit.framework.*; 17 18 24 public class TestPackage extends TestCase{ 25 26 29 public static TestSuite suite() { 30 TestSuite suite = new TestSuite(); 31 String langs[] = 32 new String [] { "RDF/XML", "RDF/XML-ABBREV", 33 "N-TRIPLE", 35 }; 37 suite.addTest(TestMacEncodings.suite()); 38 40 suite.addTest(new PrettyWriterTest("testAnonDamlClass")); 41 42 suite.addTest(new PrettyWriterTest("testLi")); 43 suite.addTest(new PrettyWriterTest("test803804")); 44 45 47 suite.addTest(new PrettyWriterTest("testRDFCollection")); 48 49 suite.addTest(new PrettyWriterTest("testOWLPrefix")); 50 51 suite.addTest(new testWriterInterface("testInterface", null)); 52 53 suite.addTest(new testWriterInterface("testNoWriter", null)); 54 55 suite.addTest(new testWriterInterface("testAnotherWriter", null)); 56 57 for (int i = 0; i < langs.length 58 ; i++) { 59 suite.addTest(testWriterAndReader.suite(langs[i])); 60 } 61 62 suite.addTest( new TestSuite( TestURIExceptions.class ) ); 63 return suite; 64 } 65 66 72 public static class TestURIExceptions extends TestCase 73 { 74 public TestURIExceptions( String name ) 75 { super( name ); } 76 77 public void testBadURIExceptionContainsBadURIInMessage() 78 { 79 String badURI = "http:"; 80 Model m = ModelFactory.createDefaultModel(); 81 m.add( m.createResource( badURI ), m.createProperty( "eg:B C" ), m.createResource( "eg:C D" ) ); 82 try { m.write( new StringWriter () ); fail( "should detect bad URI " + badURI ); } 83 catch (BadURIException e) { assertTrue( "message must contain failing URI", e.getMessage().indexOf( badURI ) > 0 ); } 84 } 85 } 86 87 } 88 89 117 | Popular Tags |