KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > graph > query > test > TestBufferPipe


1 /*
2   (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP, all rights reserved.
3   [See end of file]
4   $Id: TestBufferPipe.java,v 1.3 2005/02/21 11:52:32 andy_seaborne Exp $
5 */

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 /**
17      TestBufferPipe
18      @author kers
19 */

20 public class TestBufferPipe extends GraphTestBase
21     {
22     public TestBufferPipe( String JavaDoc 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 /*
57     (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP
58     All rights reserved.
59
60     Redistribution and use in source and binary forms, with or without
61     modification, are permitted provided that the following conditions
62     are met:
63
64     1. Redistributions of source code must retain the above copyright
65     notice, this list of conditions and the following disclaimer.
66
67     2. Redistributions in binary form must reproduce the above copyright
68     notice, this list of conditions and the following disclaimer in the
69     documentation and/or other materials provided with the distribution.
70
71     3. The name of the author may not be used to endorse or promote products
72     derived from this software without specific prior written permission.
73
74     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
75     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
76     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
77     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
78     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
79     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
80     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
81     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
82     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
83     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
84 */
Popular Tags