From 907cd33672d985b1263df3fa4e4715c7d790e1f0 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 22 Jul 2010 09:08:01 +0000 Subject: [PATCH] fix some bytesref abuse in these tests git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@966546 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/util/automaton/TestDeterminizeLexicon.java | 8 ++++---- .../org/apache/lucene/util/automaton/TestUTF32ToUTF8.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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)); } } }