[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;
|
||||
|
||||
import org.elasticsearch.common.geo.SpatialStrategy;
|
||||
import org.elasticsearch.common.geo.builders.ShapeBuilder;
|
||||
import org.elasticsearch.index.mapper.GeoShapeFieldMapper;
|
||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||
import org.elasticsearch.index.mapper.GeoShapeFieldMapper.GeoShapeFieldType;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GeoShapeFieldTypeTests extends FieldTypeTestCase {
|
||||
@Override
|
||||
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…
Reference in New Issue