### Question:
EncodedPolylineFunctions { @Description("Encodes a linestring or multipoint geometry to a polyline") @ScalarFunction("to_encoded_polyline") @SqlType(StandardTypes.VARCHAR) public static Slice toEncodedPolyline(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("encode_polyline", geometry, EnumSet.of(LINE_STRING, MULTI_POINT)); GeometryType geometryType = GeometryType.getForEsriGeometryType(geometry.geometryType()); switch (geometryType) { case LINE_STRING: case MULTI_POINT: return encodePolyline((MultiVertexGeometry) geometry.getEsriGeometry()); default: throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Unexpected geometry type: " + geometryType); } } private  EncodedPolylineFunctions(); @Description("Decodes a polyline to a linestring") @ScalarFunction("from_encoded_polyline") @SqlType(GEOMETRY_TYPE_NAME) static Slice fromEncodedPolyline(@SqlType(StandardTypes.VARCHAR) Slice input); @Description("Encodes a linestring or multipoint geometry to a polyline") @ScalarFunction("to_encoded_polyline") @SqlType(StandardTypes.VARCHAR) static Slice toEncodedPolyline(@SqlType(GEOMETRY_TYPE_NAME) Slice input);  }### Answer:
@Test public void testToEncodedPolyline() { assertToEncodedPolyline("LINESTRING EMPTY", ""); assertToEncodedPolyline("LINESTRING (-120.2 38.5, -120.95 40.7, -126.453 43.252)", "_p~iF~ps|U_ulLnnqC_mqNvxq`@"); assertToEncodedPolyline("LINESTRING (-120.2 38.5, -120.95 40.7, -126.453 43.252, -128.318 46.102)", "_p~iF~ps|U_ulLnnqC_mqNvxq`@oskPfgkJ"); assertToEncodedPolyline("MULTIPOINT EMPTY", ""); assertToEncodedPolyline("MULTIPOINT (-120.2 38.5)", "_p~iF~ps|U"); assertToEncodedPolyline("MULTIPOINT (-120.2 38.5, -120.95 40.7, -126.453 43.252)", "_p~iF~ps|U_ulLnnqC_mqNvxq`@"); assertToEncodedPolyline("MULTIPOINT (-120.2 38.5, -120.95 40.7, -126.453 43.252, -128.318 46.102)", "_p~iF~ps|U_ulLnnqC_mqNvxq`@oskPfgkJ"); assertInvalidFunction("to_encoded_polyline(ST_GeometryFromText('POINT (-120.2 38.5)'))", INVALID_FUNCTION_ARGUMENT); assertInvalidFunction("to_encoded_polyline(ST_GeometryFromText('MULTILINESTRING ((-122.39174 37.77701))'))", INVALID_FUNCTION_ARGUMENT); }