/**
* Test toEnvelope function
*/
public void testToEnvelope() {
// Option 1 (1D Envelope) : <OCQL>ToEnvelope(minx,maxx)</OCQL>
Function function = ff.function("toEnvelope", pointOne, pointTwo);
Object value = function.evaluate(feature);
assertTrue(value instanceof Envelope);
Envelope env = (Envelope) value;
assertEquals(env.getMinX(), env.getMaxX(), 0);
assertEquals(env.getMinX(), 5.0, 0);
assertEquals(env.getMinY(), env.getMaxY(), 0);
assertEquals(env.getMinY(), 2.5, 0);
// Option 2 (1D Envelope with crsname): <OCQL>ToEnvelope(minx,maxx,crsname)</OCQL>
function = ff.function("toEnvelope", pointOne, pointTwo, ff.literal("EPSG:4283"));
value = function.evaluate(feature);
assertTrue(value instanceof ReferencedEnvelope);
ReferencedEnvelope refEnv = (ReferencedEnvelope) value;
assertEquals(refEnv.getMinX(), refEnv.getMaxX(), 0);
assertEquals(refEnv.getMinX(), 5.0, 0);
assertEquals(refEnv.getMinY(), refEnv.getMaxY(), 0);
assertEquals(refEnv.getMinY(), 2.5, 0);
assertEquals(CRS.toSRS(refEnv.getCoordinateReferenceSystem()), "EPSG:4283");
// Option 3 (2D Envelope) : <OCQL>ToEnvelope(minx,maxx,miny,maxy)</OCQL>
function = ff.function("toEnvelope", pointTwo, pointOne, pointTwo, pointOne);
value = function.evaluate(feature);
assertTrue(value instanceof Envelope);
env = (Envelope) value;
assertEquals(env.getMinX(), 2.5, 0);
assertEquals(env.getMaxX(), 5.0, 0);
assertEquals(env.getMinY(), 2.5, 0);
assertEquals(env.getMaxY(), 5.0, 0);
assertEquals(CRS.toSRS(refEnv.getCoordinateReferenceSystem()), "EPSG:4283");
// Option 4 (2D Envelope with crsname): <OCQL>ToEnvelope(minx,maxx,miny,maxy,crsname)</OCQL>
function = ff.function("toEnvelope", pointTwo, pointOne, pointTwo, pointOne,
ff.literal("EPSG:4283"));
value = function.evaluate(feature);
assertTrue(value instanceof ReferencedEnvelope);
refEnv = (ReferencedEnvelope) value;
assertEquals(refEnv.getMinX(), 2.5, 0);
assertEquals(refEnv.getMaxX(), 5.0, 0);
assertEquals(refEnv.getMinY(), 2.5, 0);