diff --git a/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java b/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java index 2a5ec6c573d..31eddd3bc75 100644 --- a/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java +++ b/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java @@ -35,7 +35,7 @@ public class TestDeterminizeLexicon extends LuceneTestCase { private List terms = new ArrayList(); 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 extends LuceneTestCase { } } - 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 extends LuceneTestCase { } 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)); } } } diff --git a/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java b/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java index a275b268a8f..5ddedf71731 100644 --- a/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java +++ b/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java @@ -193,8 +193,8 @@ public class TestUTF32ToUTF8 extends LuceneTestCase { 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)); } } }