public static Optional<String> urlEncode(String raw) {
    try {
      return Optional.of(URLEncoder.encode(raw, UTF_8.toString()));
    } catch (UnsupportedEncodingException e) {
      return Optional.empty();
    }
  }
@Test
  public void urlEncode_whenNothingToEncode_returnsOriginal() {
    assertThat(urlEncode("abcdefghijklmnopqrstuvwxyz")).hasValue("abcdefghijklmnopqrstuvwxyz");
    assertThat(urlEncode("ABCDEFGHIJKLMNOPQRSTUVWXYZ")).hasValue("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    assertThat(urlEncode("0123456789")).hasValue("0123456789");
    assertThat(urlEncode("-_.*")).hasValue("-_.*");
  }