lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r763793 - in /lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie: TestIntTrieTokenStream.java TestLongTrieTokenStream.java
Date Thu, 09 Apr 2009 20:32:35 GMT
Author: uschindler
Date: Thu Apr  9 20:32:35 2009
New Revision: 763793

URL: http://svn.apache.org/viewvc?rev=763793&view=rev
Log:
Add extra check to TokenStream tests, only get attribute not create it

Modified:
    lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieTokenStream.java
    lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieTokenStream.java

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieTokenStream.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieTokenStream.java?rev=763793&r1=763792&r2=763793&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieTokenStream.java
(original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestIntTrieTokenStream.java
Thu Apr  9 20:32:35 2009
@@ -29,8 +29,10 @@
   public void testStreamNewAPI() throws Exception {
     final IntTrieTokenStream stream=new IntTrieTokenStream(value, precisionStep);
     stream.setUseNewAPI(true);
-    final ShiftAttribute shiftAtt = (ShiftAttribute) stream.addAttribute(ShiftAttribute.class);
-    final TermAttribute termAtt = (TermAttribute) stream.addAttribute(TermAttribute.class);
+    final ShiftAttribute shiftAtt = (ShiftAttribute) stream.getAttribute(ShiftAttribute.class);
+    assertNotNull("Has shift attribute", shiftAtt);
+    final TermAttribute termAtt = (TermAttribute) stream.getAttribute(TermAttribute.class);
+    assertNotNull("Has term attribute", termAtt);
     for (int shift=0; shift<32; shift+=precisionStep) {
       assertTrue("New token is available", stream.incrementToken());
       assertEquals("Shift value", shift, shiftAtt.getShift());

Modified: lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieTokenStream.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieTokenStream.java?rev=763793&r1=763792&r2=763793&view=diff
==============================================================================
--- lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieTokenStream.java
(original)
+++ lucene/java/trunk/contrib/queries/src/test/org/apache/lucene/search/trie/TestLongTrieTokenStream.java
Thu Apr  9 20:32:35 2009
@@ -29,8 +29,10 @@
   public void testStreamNewAPI() throws Exception {
     final LongTrieTokenStream stream=new LongTrieTokenStream(value, precisionStep);
     stream.setUseNewAPI(true);
-    final ShiftAttribute shiftAtt = (ShiftAttribute) stream.addAttribute(ShiftAttribute.class);
-    final TermAttribute termAtt = (TermAttribute) stream.addAttribute(TermAttribute.class);
+    final ShiftAttribute shiftAtt = (ShiftAttribute) stream.getAttribute(ShiftAttribute.class);
+    assertNotNull("Has shift attribute", shiftAtt);
+    final TermAttribute termAtt = (TermAttribute) stream.getAttribute(TermAttribute.class);
+    assertNotNull("Has term attribute", termAtt);
     for (int shift=0; shift<64; shift+=precisionStep) {
       assertTrue("New token is available", stream.incrementToken());
       assertEquals("Shift value", shift, shiftAtt.getShift());



Mime
View raw message