Skip to content

Commit

Permalink
Fix the geo_point unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
  • Loading branch information
rishabhmaurya committed Apr 10, 2024
1 parent df047ed commit ef7e859
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.apache.lucene.document.LatLonPoint;
import org.apache.lucene.document.LongField;
import org.apache.lucene.document.LongPoint;
import org.opensearch.common.collect.Tuple;
import org.opensearch.script.Script;

import java.util.List;
Expand Down Expand Up @@ -51,7 +52,7 @@ public void testDateType() {
public void testGeoPointType() {
DerivedFieldType dft = createDerivedFieldType("geo_point");
assertTrue(dft.typeFieldMapper instanceof GeoPointFieldMapper);
assertTrue(dft.indexableFieldGenerator.apply(List.of(10.0, 20.0)) instanceof LatLonPoint);
assertTrue(dft.indexableFieldGenerator.apply(new Tuple<>(10.0, 20.0)) instanceof LatLonPoint);
expectThrows(ClassCastException.class, () -> dft.indexableFieldGenerator.apply(List.of(10.0)));
expectThrows(ClassCastException.class, () -> dft.indexableFieldGenerator.apply(List.of()));
expectThrows(ClassCastException.class, () -> dft.indexableFieldGenerator.apply(List.of("10")));
Expand Down

0 comments on commit ef7e859

Please sign in to comment.