lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject [11/50] [abbrv] lucene-solr:apiv2: LUCENE-7331: Remove GeoPointTestUtil from TestGeoPointQuery.
Date Thu, 16 Jun 2016 12:08:41 GMT
LUCENE-7331: Remove GeoPointTestUtil from TestGeoPointQuery.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f767855d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f767855d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f767855d

Branch: refs/heads/apiv2
Commit: f767855da30e8d8b070b7566cb6eebb29af63334
Parents: b33d717
Author: Nicholas Knize <nknize@gmail.com>
Authored: Fri Jun 10 12:30:46 2016 -0500
Committer: Nicholas Knize <nknize@gmail.com>
Committed: Fri Jun 10 12:49:52 2016 -0500

----------------------------------------------------------------------
 .../geopoint/search/TestGeoPointQuery.java      | 37 ++++++++++----------
 1 file changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f767855d/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
----------------------------------------------------------------------
diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
b/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
index 1ac9ffe..a657fd0 100644
--- a/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/TestGeoPointQuery.java
@@ -17,11 +17,14 @@
 package org.apache.lucene.spatial.geopoint.search;
 
 import org.apache.lucene.document.Document;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.geo.BaseGeoPointTestCase;
 import org.apache.lucene.geo.Polygon;
-import org.apache.lucene.geo.Rectangle;
 import org.apache.lucene.spatial.geopoint.document.GeoPointField;
+import org.apache.lucene.store.Directory;
 
 /**
  * random testing for GeoPoint query logic
@@ -60,25 +63,23 @@ public class TestGeoPointQuery extends BaseGeoPointTestCase {
     return new GeoPointInPolygonQuery(field, polygons);
   }
 
-  // TODO: remove these once we get tests passing!
+  /** explicit test failure for LUCENE-7325 */
+  public void testInvalidShift() throws Exception {
+    Directory dir = newDirectory();
+    RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
 
-  @Override
-  protected double nextLongitude() {
-    return GeoPointTestUtil.nextLongitude();
-  }
-
-  @Override
-  protected double nextLatitude() {
-    return GeoPointTestUtil.nextLatitude();
-  }
+    // add a doc with a point
+    Document document = new Document();
+    addPointToDoc("field", document, 80, -65);
+    writer.addDocument(document);
 
-  @Override
-  protected Rectangle nextBox() {
-    return GeoPointTestUtil.nextBox();
-  }
+    // search and verify we found our doc
+    IndexReader reader = writer.getReader();
+    IndexSearcher searcher = newSearcher(reader);
+    assertEquals(0, searcher.count(newRectQuery("field", 90, 90, -180, 0)));
 
-  @Override
-  protected Polygon nextPolygon() {
-    return GeoPointTestUtil.nextPolygon();
+    reader.close();
+    writer.close();
+    dir.close();
   }
 }


Mime
View raw message