@Test
public void simpleTemplateWithRegularExpressions() {

  String template = "https://www.example.com/{foo:[0-9]{4}}/{bar}";
  UriTemplate uriTemplate = UriTemplate.create(template, Util.UTF_8);
  assertThat(uriTemplate.getVariables()).contains("foo", "bar").hasSize(2);
  Map<String, Object> variables = new LinkedHashMap<>();
  variables.put("foo", 1234);
  variables.put("bar", "stuff");
  String expandedTemplate = uriTemplate.expand(variables);
  assertThat(expandedTemplate).isEqualToIgnoringCase("https://www.example.com/1234/stuff");
  assertThat(URI.create(expandedTemplate)).isNotNull();
}