You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2010/07/04 19:25:34 UTC

svn commit: r960364 - /lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java

Author: mikemccand
Date: Sun Jul  4 17:25:34 2010
New Revision: 960364

URL: http://svn.apache.org/viewvc?rev=960364&view=rev
Log:
cutover TestSurrogates to use LuceneTestCase.VERBOSE instead of its own DEBUG; cutover to J4

Modified:
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java?rev=960364&r1=960363&r2=960364&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java Sun Jul  4 17:25:34 2010
@@ -25,9 +25,10 @@ import org.apache.lucene.util.*;
 import java.util.*;
 import java.io.IOException;
 
-public class TestSurrogates extends LuceneTestCase {
+import static org.junit.Assert.*;
+import org.junit.Test;
 
-  private static final boolean DEBUG = false;
+public class TestSurrogates extends LuceneTestCaseJ4 {
 
   // like Term, but uses BytesRef for text
   private static class FieldAndText implements Comparable<FieldAndText> {
@@ -116,7 +117,7 @@ public class TestSurrogates extends Luce
     BytesRef utf8 = new BytesRef(10);
     String lastText = null;
     int uniqueTermCount = 0;
-    if (DEBUG) {
+    if (VERBOSE) {
       System.out.println("TEST: utf16 order:");
     }
     for(Term t : terms) {
@@ -131,7 +132,7 @@ public class TestSurrogates extends Luce
       lastText = text;
       UnicodeUtil.UTF16toUTF8(text, 0, text.length(), utf8);
 
-      if (DEBUG) {
+      if (VERBOSE) {
         System.out.println("  " + toHexString(t));
       }
       w.add(fi.number, utf8.bytes, utf8.length, ti);
@@ -139,7 +140,7 @@ public class TestSurrogates extends Luce
     w.close();
 
     Collections.sort(fieldTerms);
-    if (DEBUG) {
+    if (VERBOSE) {
       System.out.println("\nTEST: codepoint order");
       for(FieldAndText t: fieldTerms) {
         System.out.println("  " + t.field + ":" + UnicodeUtil.toHexString(t.text.utf8ToString()));
@@ -156,7 +157,8 @@ public class TestSurrogates extends Luce
   private String toHexString(Term t) {
     return t.field() + ":" + UnicodeUtil.toHexString(t.text());
   }
-
+  
+  @Test
   public void testSurrogatesOrder() throws Exception {
     Directory dir = new MockRAMDirectory();
 
@@ -173,7 +175,7 @@ public class TestSurrogates extends Luce
     FieldsProducer fields = codec.fieldsProducer(new SegmentReadState(dir, si, fieldInfos, 1024, 1));
     assertNotNull(fields);
 
-    if (DEBUG) {
+    if (VERBOSE) {
       System.out.println("\nTEST: now enum");
     }
     FieldsEnum fieldsEnum = fields.iterator();
@@ -187,7 +189,7 @@ public class TestSurrogates extends Luce
       BytesRef lastText = null;
       while((text = termsEnum.next()) != null) {
         UnicodeUtil.UTF8toUTF16(text.bytes, text.offset, text.length, utf16);
-        if (DEBUG) {
+        if (VERBOSE) {
           System.out.println("got term=" + field + ":" + UnicodeUtil.toHexString(new String(utf16.result, 0, utf16.length)));
           System.out.println();
         }
@@ -201,7 +203,7 @@ public class TestSurrogates extends Luce
         assertEquals(fieldTerms.get(termCount).text, text);
         termCount++;
       }
-      if (DEBUG) {
+      if (VERBOSE) {
         System.out.println("  no more terms for field=" + field);
       }
     }