lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1145452 - /lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
Date Tue, 12 Jul 2011 04:41:11 GMT
Author: rmuir
Date: Tue Jul 12 04:41:10 2011
New Revision: 1145452

URL: http://svn.apache.org/viewvc?rev=1145452&view=rev
Log:
fix test to use randoms from @beforeClass, so that the seed is set from LuceneTestCase

Modified:
    lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java

Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java?rev=1145452&r1=1145451&r2=1145452&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
(original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestNumericQueryParser.java
Tue Jul 12 04:41:10 2011
@@ -63,26 +63,31 @@ public class TestNumericQueryParser exte
   
   final private static int PRECISION_STEP = 8;
   final private static String FIELD_NAME = "field";
-  final private static Locale LOCALE = randomLocale(random);
-  final private static TimeZone TIMEZONE = randomTimeZone(random);
-  final private static Map<String,Number> RANDOM_NUMBER_MAP;
+  private static Locale LOCALE;
+  private static TimeZone TIMEZONE;
+  private static Map<String,Number> RANDOM_NUMBER_MAP;
   final private static EscapeQuerySyntax ESCAPER = new EscapeQuerySyntaxImpl();
   final private static String DATE_FIELD_NAME = "date";
-  final private static int DATE_STYLE = randomDateStyle(random);
-  final private static int TIME_STYLE = randomDateStyle(random);
+  private static int DATE_STYLE;
+  private static int TIME_STYLE;
   
-  final private static Analyzer ANALYZER = new MockAnalyzer(random);
+  private static Analyzer ANALYZER;
   
-  final private static NumberFormat NUMBER_FORMAT = NumberFormat
-      .getNumberInstance(LOCALE);
+  private static NumberFormat NUMBER_FORMAT;
   
-  final private static StandardQueryParser qp = new StandardQueryParser(
-      ANALYZER);
+  private static StandardQueryParser qp;
   
-  final private static NumberDateFormat DATE_FORMAT;
+  private static NumberDateFormat DATE_FORMAT;
   
-  static {
+  static void init() {
     try {
+      LOCALE = randomLocale(random);
+      TIMEZONE = randomTimeZone(random);
+      DATE_STYLE = randomDateStyle(random);
+      TIME_STYLE = randomDateStyle(random);
+      ANALYZER = new MockAnalyzer(random);
+      qp = new StandardQueryParser(ANALYZER);
+      NUMBER_FORMAT = NumberFormat.getNumberInstance(LOCALE);
       NUMBER_FORMAT.setMaximumFractionDigits((random.nextInt() & 20) + 1);
       NUMBER_FORMAT.setMinimumFractionDigits((random.nextInt() & 20) + 1);
       NUMBER_FORMAT.setMaximumIntegerDigits((random.nextInt() & 20) + 1);
@@ -145,6 +150,7 @@ public class TestNumericQueryParser exte
   
   @BeforeClass
   public static void beforeClass() throws Exception {
+    init();
     directory = newDirectory();
     RandomIndexWriter writer = new RandomIndexWriter(random, directory,
         newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))



Mime
View raw message