lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r966546 - in /lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton: TestDeterminizeLexicon.java TestUTF32ToUTF8.java
Date Thu, 22 Jul 2010 09:08:01 GMT
Author: rmuir
Date: Thu Jul 22 09:08:01 2010
New Revision: 966546

URL: http://svn.apache.org/viewvc?rev=966546&view=rev
Log:
fix some bytesref abuse in these tests

Modified:
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java?rev=966546&r1=966545&r2=966546&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java
(original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java
Thu Jul 22 09:08:01 2010
@@ -35,7 +35,7 @@ public class TestDeterminizeLexicon exte
   private List<String> terms = new ArrayList<String>();
   private Random random;
   
-  public void testLexicon() {
+  public void testLexicon() throws Exception {
     random = newRandom();
     for (int i = 0; i < 3*_TestUtil.getRandomMultiplier(); i++) {
       automata.clear();
@@ -49,7 +49,7 @@ public class TestDeterminizeLexicon exte
     }
   }
   
-  public void assertLexicon() {
+  public void assertLexicon() throws Exception {
     Collections.shuffle(automata, random);
     final Automaton lex = BasicOperations.union(automata);
     lex.determinize();
@@ -59,8 +59,8 @@ public class TestDeterminizeLexicon exte
     }
     final ByteRunAutomaton lexByte = new ByteRunAutomaton(lex);
     for (String s : terms) {
-      BytesRef termByte = new BytesRef(s);
-      assertTrue(lexByte.run(termByte.bytes, 0, termByte.length));
+      byte bytes[] = s.getBytes("UTF-8");
+      assertTrue(lexByte.run(bytes, 0, bytes.length));
     }
   }
 }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java?rev=966546&r1=966545&r2=966546&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java
(original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java
Thu Jul 22 09:08:01 2010
@@ -193,8 +193,8 @@ public class TestUTF32ToUTF8 extends Luc
           throw e;
         }
       }
-      BytesRef bytesRef = new BytesRef(string);
-      assertEquals(cra.run(string), bra.run(bytesRef.bytes, 0, bytesRef.length));
+      byte bytes[] = string.getBytes("UTF-8");
+      assertEquals(cra.run(string), bra.run(bytes, 0, bytes.length));
     }
   }
 }



Mime
View raw message