### Question:
UrlFunctions { @SqlNullable @Description("Extract query parameter from url") @ScalarFunction @LiteralParameters({"x", "y"}) @SqlType("varchar(x)") public static Slice urlExtractParameter(@SqlType("varchar(x)") Slice url, @SqlType("varchar(y)") Slice parameterName) { URI uri = parseUrl(url); if ((uri == null) || (uri.getRawQuery() == null)) { return null; } String parameter = parameterName.toStringUtf8(); Iterable<String> queryArgs = QUERY_SPLITTER.split(uri.getRawQuery()); for (String queryArg : queryArgs) { Iterator<String> arg = ARG_SPLITTER.split(queryArg).iterator(); if (arg.next().equals(parameter)) { if (arg.hasNext()) { return decodeUrl(arg.next()); } return Slices.EMPTY_SLICE; } } return null; } private  UrlFunctions(); @SqlNullable @Description("Extract protocol from url") @ScalarFunction @LiteralParameters("x") @SqlType("varchar(x)") static Slice urlExtractProtocol(@SqlType("varchar(x)") Slice url); @SqlNullable @Description("Extract host from url") @ScalarFunction @LiteralParameters("x") @SqlType("varchar(x)") static Slice urlExtractHost(@SqlType("varchar(x)") Slice url); @SqlNullable @Description("Extract port from url") @ScalarFunction @LiteralParameters("x") @SqlType(StandardTypes.BIGINT) static Long urlExtractPort(@SqlType("varchar(x)") Slice url); @SqlNullable @Description("Extract part from url") @ScalarFunction @LiteralParameters("x") @SqlType("varchar(x)") static Slice urlExtractPath(@SqlType("varchar(x)") Slice url); @SqlNullable @Description("Extract query from url") @ScalarFunction @LiteralParameters("x") @SqlType("varchar(x)") static Slice urlExtractQuery(@SqlType("varchar(x)") Slice url); @SqlNullable @Description("Extract fragment from url") @ScalarFunction @LiteralParameters("x") @SqlType("varchar(x)") static Slice urlExtractFragment(@SqlType("varchar(x)") Slice url); @SqlNullable @Description("Extract query parameter from url") @ScalarFunction @LiteralParameters({"x", "y"}) @SqlType("varchar(x)") static Slice urlExtractParameter(@SqlType("varchar(x)") Slice url, @SqlType("varchar(y)") Slice parameterName); @Description("Escape a string for use in URL query parameter names and values") @ScalarFunction @LiteralParameters({"x", "y"}) @Constraint(variable = "y", expression = "min(2147483647, x * 12)") @SqlType("varchar(y)") static Slice urlEncode(@SqlType("varchar(x)") Slice value); @Description("Unescape a URL-encoded string") @ScalarFunction @LiteralParameters("x") @SqlType("varchar(x)") static Slice urlDecode(@SqlType("varchar(x)") Slice value);  }### Answer:
@Test public void testUrlExtractParameter() { assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('http: assertFunction("url_extract_parameter('foo', 'k1')", createVarcharType(3), null); }