1 6 package com.hp.hpl.jena.rdf.model.test; 7 8 import java.io.StringReader ; 9 10 import com.hp.hpl.jena.graph.*; 11 import com.hp.hpl.jena.rdf.model.*; 12 13 import junit.framework.TestSuite; 14 15 19 public class TestReaderEvents extends ModelTestBase 20 { 21 public TestReaderEvents( String name ) 22 { super(name); } 23 24 public static TestSuite suite() 25 { return new TestSuite( TestReaderEvents.class ); } 26 27 public void testXMLReaderEvents() 28 { 29 String emptyModel = "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'></rdf:RDF>"; 30 testReaderEvent( "RDF/XML", emptyModel ); 31 } 32 33 public void testN3ReaderEvents() 34 { 35 testReaderEvent( "N3", "" ); 36 } 37 38 public void testNTriplesReaderEvents() 39 { 40 testReaderEvent( "N-TRIPLE", "" ); 41 } 42 43 public void testReaderEvent( String language, String emptyModel ) 44 { 45 Model m = ModelFactory.createDefaultModel(); 46 RecordingModelListener L = new RecordingModelListener(); 47 m.register( L ); 48 RDFReader r = m.getReader( language ); 49 StringReader stringReader = new StringReader ( emptyModel ); 50 r.read( m, stringReader, "" ); 51 L.assertHasStart( new Object [] {"someEvent", m, GraphEvents.startRead} ); 52 L.assertHasEnd( new Object [] {"someEvent", m, GraphEvents.finishRead} ); 53 } 54 55 } 56 57 58 | Popular Tags |