1 6 package com.hp.hpl.jena.graph.query.test; 7 8 import junit.framework.TestSuite; 9 10 import com.hp.hpl.jena.graph.query.*; 11 import com.hp.hpl.jena.graph.query.BufferPipe; 12 import com.hp.hpl.jena.graph.test.GraphTestBase; 13 import com.hp.hpl.jena.shared.*; 14 import com.hp.hpl.jena.shared.JenaException; 15 16 20 public class TestBufferPipe extends GraphTestBase 21 { 22 public TestBufferPipe( String name ) 23 { super( name ); } 24 25 public static TestSuite suite() 26 { return new TestSuite( TestBufferPipe.class ); } 27 28 public void testEmpty() 29 { 30 Pipe p = new BufferPipe(); 31 p.close(); 32 assertFalse( p.hasNext() ); 33 } 34 35 public void testNonEmpty() 36 { 37 Pipe p = new BufferPipe(); 38 p.put( new Domain( 0 ) ); 39 p.close(); 40 assertTrue( p.hasNext() ); 41 p.get(); 42 assertFalse( p.hasNext() ); 43 } 44 45 public void testExceptions() 46 { 47 Pipe p = new BufferPipe(); 48 JenaException bang = new JenaException( "bang" ); 49 p.close( bang ); 50 try { p.get(); fail( "bang disappeared" ); } 51 catch (QueryStageException e) { pass(); } 52 } 53 } 54 55 56 | Popular Tags |