mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
[Tests] Add test for GeoShapeFieldType#setStrategyName (#27703)
This commit is contained in:
parent
6efee323e0
commit
816878bd4d
@ -18,11 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.elasticsearch.index.mapper;
|
package org.elasticsearch.index.mapper;
|
||||||
|
|
||||||
|
import org.elasticsearch.common.geo.SpatialStrategy;
|
||||||
import org.elasticsearch.common.geo.builders.ShapeBuilder;
|
import org.elasticsearch.common.geo.builders.ShapeBuilder;
|
||||||
import org.elasticsearch.index.mapper.GeoShapeFieldMapper;
|
import org.elasticsearch.index.mapper.GeoShapeFieldMapper.GeoShapeFieldType;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class GeoShapeFieldTypeTests extends FieldTypeTestCase {
|
public class GeoShapeFieldTypeTests extends FieldTypeTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected MappedFieldType createDefaultFieldType() {
|
protected MappedFieldType createDefaultFieldType() {
|
||||||
@ -68,4 +70,17 @@ public class GeoShapeFieldTypeTests extends FieldTypeTestCase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for {@link GeoShapeFieldType#setStrategyName(String)} that checks that {@link GeoShapeFieldType#pointsOnly()}
|
||||||
|
* gets set as a side effect when using SpatialStrategy.TERM
|
||||||
|
*/
|
||||||
|
public void testSetStrategyName() throws IOException {
|
||||||
|
GeoShapeFieldType fieldType = new GeoShapeFieldMapper.GeoShapeFieldType();
|
||||||
|
assertFalse(fieldType.pointsOnly());
|
||||||
|
fieldType.setStrategyName(SpatialStrategy.RECURSIVE.getStrategyName());
|
||||||
|
assertFalse(fieldType.pointsOnly());
|
||||||
|
fieldType.setStrategyName(SpatialStrategy.TERM.getStrategyName());
|
||||||
|
assertTrue(fieldType.pointsOnly());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user