You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2012/02/21 06:57:36 UTC

svn commit: r1291611 - in /lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial: RandomSeed.java base/distance/TestDistances.java base/shape/AbstractTestShapes.java

Author: dsmiley
Date: Tue Feb 21 05:57:35 2012
New Revision: 1291611

URL: http://svn.apache.org/viewvc?rev=1291611&view=rev
Log:
Removed RandomSeed; simply extend LuceneTestCase instead.

Removed:
    lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/RandomSeed.java
Modified:
    lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/distance/TestDistances.java
    lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/shape/AbstractTestShapes.java

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/distance/TestDistances.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/distance/TestDistances.java?rev=1291611&r1=1291610&r2=1291611&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/distance/TestDistances.java (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/distance/TestDistances.java Tue Feb 21 05:57:35 2012
@@ -17,26 +17,20 @@
 
 package org.apache.lucene.spatial.base.distance;
 
-import org.apache.lucene.spatial.RandomSeed;
 import org.apache.lucene.spatial.base.context.SpatialContext;
 import org.apache.lucene.spatial.base.context.simple.SimpleSpatialContext;
-import org.apache.lucene.spatial.base.shape.SpatialRelation;
 import org.apache.lucene.spatial.base.shape.Point;
 import org.apache.lucene.spatial.base.shape.Rectangle;
+import org.apache.lucene.spatial.base.shape.SpatialRelation;
+import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Random;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 /**
  * @author David Smiley - dsmiley@mitre.org
  */
-public class TestDistances {
+public class TestDistances extends LuceneTestCase {
 
-  private final Random random = new Random(RandomSeed.seed());
   //NOTE!  These are sometimes modified by tests.
   private SpatialContext ctx;
   private double EPS;
@@ -225,7 +219,6 @@ public class TestDistances {
     for (double[] pair : lats) {
       assertEquals("input "+pair[0],pair[1],ctx.normY(pair[0]),0);
     }
-    Random random = new Random(RandomSeed.seed());
     for(int i = -1000; i < 1000; i += random.nextInt(10)*10) {
       double d = ctx.normY(i);
       assertTrue(i + " " + d, d >= -90 && d <= 90);
@@ -241,7 +234,6 @@ public class TestDistances {
     for (double[] pair : lons) {
       assertEquals("input "+pair[0],pair[1],ctx.normX(pair[0]),0);
     }
-    Random random = new Random(RandomSeed.seed());
     for(int i = -1000; i < 1000; i += random.nextInt(10)*10) {
       double d = ctx.normX(i);
       assertTrue(i + " " + d, d >= -180 && d < 180);

Modified: lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/shape/AbstractTestShapes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/shape/AbstractTestShapes.java?rev=1291611&r1=1291610&r2=1291611&view=diff
==============================================================================
--- lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/shape/AbstractTestShapes.java (original)
+++ lucene/dev/branches/lucene3795_lsp_spatial_module/modules/spatial/src/test/org/apache/lucene/spatial/base/shape/AbstractTestShapes.java Tue Feb 21 05:57:35 2012
@@ -17,32 +17,25 @@
 
 package org.apache.lucene.spatial.base.shape;
 
-import org.apache.lucene.spatial.RandomSeed;
 import org.apache.lucene.spatial.base.context.SpatialContext;
 import org.apache.lucene.spatial.base.distance.DistanceCalculator;
+import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Before;
 
 import java.util.Random;
 
-import static org.apache.lucene.spatial.base.shape.SpatialRelation.CONTAINS;
-import static org.apache.lucene.spatial.base.shape.SpatialRelation.DISJOINT;
-import static org.apache.lucene.spatial.base.shape.SpatialRelation.WITHIN;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.apache.lucene.spatial.base.shape.SpatialRelation.*;
 
 /**
  * @author David Smiley - dsmiley@mitre.org
  */
-public abstract class AbstractTestShapes {
-  protected Random random;
+public abstract class AbstractTestShapes extends LuceneTestCase {
 
   protected SpatialContext ctx;
   private static final double EPS = 10e-9;
 
   @Before
   public void beforeClass() {
-    random = new Random(RandomSeed.seed());
     ctx = getContext();
   }