lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject cvs commit: jakarta-lucene/src/test/org/apache/lucene/index TestMultiReader.java TestSegmentReader.java
Date Fri, 06 Aug 2004 21:32:51 GMT
dnaber      2004/08/06 14:32:51

  Modified:    src/test/org/apache/lucene/index TestMultiReader.java
                        TestSegmentReader.java
  Log:
  don't try to catch exceptions that are not thrown anymore
  
  Revision  Changes    Path
  1.4       +2 -7      jakarta-lucene/src/test/org/apache/lucene/index/TestMultiReader.java
  
  Index: TestMultiReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/index/TestMultiReader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestMultiReader.java	16 Apr 2004 09:17:05 -0000	1.3
  +++ TestMultiReader.java	6 Aug 2004 21:32:51 -0000	1.4
  @@ -87,12 +87,7 @@
     }
     
     public void testTermVectors() {
  -    try {
  -      MultiReader reader = new MultiReader(dir, sis, false, readers);
  -      assertTrue(reader != null);
  -    } catch (IOException e) {
  -      e.printStackTrace();
  -      assertTrue(false);
  -    }
  +    MultiReader reader = new MultiReader(dir, sis, false, readers);
  +    assertTrue(reader != null);
     }    
   }
  
  
  
  1.3       +40 -53    jakarta-lucene/src/test/org/apache/lucene/index/TestSegmentReader.java
  
  Index: TestSegmentReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/index/TestSegmentReader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestSegmentReader.java	29 Mar 2004 22:48:06 -0000	1.2
  +++ TestSegmentReader.java	6 Aug 2004 21:32:51 -0000	1.3
  @@ -104,40 +104,33 @@
     }    
     
     public void testGetFieldNameVariations() {
  -    try {
  -      Collection result = reader.getFieldNames();
  -      assertTrue(result != null);
  -      assertTrue(result.size() == 7);
  -      for (Iterator iter = result.iterator(); iter.hasNext();) {
  -        String s = (String) iter.next();
  -        //System.out.println("Name: " + s);
  -        assertTrue(DocHelper.nameValues.containsKey(s) == true || s.equals(""));
  -      }                                                                               
  -      result = reader.getFieldNames(true);
  -      assertTrue(result != null);
  -//      System.out.println("Size: " + result.size());
  -      assertTrue(result.size() == 5);
  -      for (Iterator iter = result.iterator(); iter.hasNext();) {
  -        String s = (String) iter.next();
  -        assertTrue(DocHelper.nameValues.containsKey(s) == true || s.equals(""));
  -      }
  -      
  -      result = reader.getFieldNames(false);
  -      assertTrue(result != null);
  -      assertTrue(result.size() == 2);
  -      //Get all indexed fields that are storing term vectors
  -      result = reader.getIndexedFieldNames(true);
  -      assertTrue(result != null);
  -      assertTrue(result.size() == 2);
  -      
  -      result = reader.getIndexedFieldNames(false);
  -      assertTrue(result != null);
  -      assertTrue(result.size() == 3);
  -      
  -    } catch (IOException e) {
  -      e.printStackTrace();
  -      assertTrue(false);
  +    Collection result = reader.getFieldNames();
  +    assertTrue(result != null);
  +    assertTrue(result.size() == 7);
  +    for (Iterator iter = result.iterator(); iter.hasNext();) {
  +      String s = (String) iter.next();
  +      //System.out.println("Name: " + s);
  +      assertTrue(DocHelper.nameValues.containsKey(s) == true || s.equals(""));
  +    }                                                                               
  +    result = reader.getFieldNames(true);
  +    assertTrue(result != null);
  +    assertTrue(result.size() == 5);
  +    for (Iterator iter = result.iterator(); iter.hasNext();) {
  +      String s = (String) iter.next();
  +      assertTrue(DocHelper.nameValues.containsKey(s) == true || s.equals(""));
       }
  +    
  +    result = reader.getFieldNames(false);
  +    assertTrue(result != null);
  +    assertTrue(result.size() == 2);
  +    //Get all indexed fields that are storing term vectors
  +    result = reader.getIndexedFieldNames(true);
  +    assertTrue(result != null);
  +    assertTrue(result.size() == 2);
  +    
  +    result = reader.getIndexedFieldNames(false);
  +    assertTrue(result != null);
  +    assertTrue(result.size() == 3);
     } 
     
     public void testTerms() {
  @@ -186,27 +179,21 @@
     }    
     
     public void testTermVectors() {
  -    try {
  -      TermFreqVector result = reader.getTermFreqVector(0, DocHelper.TEXT_FIELD_2_KEY);
  -      assertTrue(result != null);
  -      String [] terms = result.getTerms();
  -      int [] freqs = result.getTermFrequencies();
  -      assertTrue(terms != null && terms.length == 3 && freqs != null &&
freqs.length == 3);
  -      for (int i = 0; i < terms.length; i++) {
  -        String term = terms[i];
  -        int freq = freqs[i];
  -        assertTrue(DocHelper.FIELD_2_TEXT.indexOf(term) != -1);
  -        assertTrue(freq > 0);
  -      }
  -  
  -      TermFreqVector [] results = reader.getTermFreqVectors(0);
  -      assertTrue(results != null);
  -      assertTrue(results.length == 2);      
  -      
  -    } catch (IOException e) {
  -      e.printStackTrace();
  -      assertTrue(false);
  +    TermFreqVector result = reader.getTermFreqVector(0, DocHelper.TEXT_FIELD_2_KEY);
  +    assertTrue(result != null);
  +    String [] terms = result.getTerms();
  +    int [] freqs = result.getTermFrequencies();
  +    assertTrue(terms != null && terms.length == 3 && freqs != null &&
freqs.length == 3);
  +    for (int i = 0; i < terms.length; i++) {
  +      String term = terms[i];
  +      int freq = freqs[i];
  +      assertTrue(DocHelper.FIELD_2_TEXT.indexOf(term) != -1);
  +      assertTrue(freq > 0);
       }
  +
  +    TermFreqVector [] results = reader.getTermFreqVectors(0);
  +    assertTrue(results != null);
  +    assertTrue(results.length == 2);      
     }    
     
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message