Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/java/org/joist/search SearchTest.java

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: joist/java/org/joist/search SearchTest.java

Author stack
Full name Michael Stack
Date 2000-10-24 10:17:59 PDT
Message User: stack
  Date: 00/10/24 10:17:59

  Modified: java/org/joist/search SearchTest.java
  Log:
  Added badQuery and badSearchEngineIndex tests
  
  Revision Changes Path
  1.2 +33 -6 joist/java/org/joist​/search/SearchTest.j​ava
  
  Index: SearchTest.java
  ====================​====================​====================​=======
  RCS file: /cvs/joist/java/org/​joist/search/SearchT​est.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SearchTest.java 2000/10/23 23:21:45 1.1
  +++ SearchTest.java 2000/10/24 17:17:59 1.2
  @@ -81,7 +81,7 @@
   *
   * @see <a href="http://www.junit.org">JUnit Site</a>
   * @author <a href="mailto:stack@c​ollab.net">St.Ack​</a>
  -* @version $Id: SearchTest.java,v 1.1 2000/10/23 23:21:45 stack Exp $
  +* @version $Id: SearchTest.java,v 1.2 2000/10/24 17:17:59 stack Exp $
   */
   public class SearchTest
       extends junit.framework.TestCase
  @@ -89,7 +89,7 @@
       /** Class version string
       */
       public static final String versionID
  - = "$Id: SearchTest.java,v 1.1 2000/10/23 23:21:45 stack Exp $";
  + = "$Id: SearchTest.java,v 1.2 2000/10/24 17:17:59 stack Exp $";
       
       
       /** Use this key to pull query from system properties.
  @@ -194,7 +194,7 @@
          }
       }
       
  - /** Test query is non-null
  + /** Test a bad query
       */
       public void testBadQuery( )
       {
  @@ -216,6 +216,32 @@
          }
       }
       
  +
  + /** Test what happens if i enter a bad index.
  + * Should get filenotfound exception.
  + */
  + public void testBadIndex( )
  + {
  + try
  + {
  + SearchSwishe swishe = new SearchSwishe( PATH_TO_BINARY );
  + assertNotNull( "Swishe object is null", swishe );
  + Query query = new Query( strQuery,
  + "/BAD_INDEX",
  + PAGES_PER_QUERY );
  + }
  +
  + catch( java.io.FileNotFoundException fnfexception )
  + {
  + // What we expected from our bad index
  + }
  +
  + catch( Exception exception )
  + {
  + fail( exception.toString( ) );
  + }
  + }
  +
       
        /** Test query is non-null
       */
  @@ -230,7 +256,7 @@
                               PAGES_PER_QUERY );
               assertNotNull( "Query object is null", query );
               SearchResult searchresult = null;
  - for( int i = 0; i < 1000; i++ )
  + for( int i = 0; i < 10; i++ )
               {
                   searchresult = swishe.query( query );
                   assertNotNull( "SearchResult object is null", searchresult );
  @@ -248,7 +274,7 @@
       */
       public void testQueries( )
       {
  - for( int i = 0; i < 1000; i++ )
  + for( int i = 0; i < 10; i++ )
           {
               testQuery( );
           }
  @@ -264,7 +290,8 @@
           suite.addTest( new SearchTest( "testStrQueryNull" ) );
           suite.addTest( new SearchTest( "testIndexNull" ) );
           suite.addTest( new SearchTest( "testQuery" ) );
  - suite.addTest( new SearchTest( "testBadQuery" ) );
  + suite.addTest( new SearchTest( "testBadQuery" ) );
  + suite.addTest( new SearchTest( "testBadIndex" ) );
           suite.addTest( new SearchTest( "testQueries" ) );
           suite.addTest( new SearchTest( "testQueryOnOneSwishe" ) );
           return suite;

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: joist/java/org/joist/search SearchTest.java stack Michael Stack 2000-10-24 10:17:59 PDT
Messages per page: