@Udf(description = "Returns a new string with all occurences of oldStr in str with newStr")
  public String replace(
      @UdfParameter(
          description = "The source string. If null, then function returns null.") final String str,
      @UdfParameter(
          description = "The substring to replace."
              + " If null, then function returns null.") final String oldStr,
      @UdfParameter(
          description = "The string to replace the old substrings with."
              + " If null, then function returns null.") final String newStr) {
    if (str == null || oldStr == null || newStr == null) {
      return null;
    }

    return str.replace(oldStr, newStr);
  }
@Test
  public void shouldReplace() {
    assertThat(udf.replace("foobar", "foo", "bar"), is("barbar"));
    assertThat(udf.replace("foobar", "fooo", "bar"), is("foobar"));
    assertThat(udf.replace("foobar", "o", ""), is("fbar"));
    assertThat(udf.replace("abc", "", "n"), is("nanbncn"));
  }