@Test
public void encodeVariables() {

  String template = "https://www.example.com/{first}/{last}";
  UriTemplate uriTemplate = UriTemplate.create(template, Util.UTF_8);
  Map<String, Object> variables = new LinkedHashMap<>();
  variables.put("first", "John Jacob");
  variables.put("last", "Jingleheimer Schmidt");
  String expandedTemplate = uriTemplate.expand(variables);
  assertThat(expandedTemplate)
      .isEqualToIgnoringCase("https://www.example.com/John%20Jacob/Jingleheimer%20Schmidt");
}