public static String escapePathSegment(String segment)
  {
    //identity comparison - wildcard must be specific instance in PathSpec
    if (segment == PathSpec.WILDCARD)
    {
      return "$*";
    }

    return escape(segment);
  }
@Test
  public void testEscapePathSegment()
  {
    assertEquals(Escaper.escapePathSegment("*"), "*");
    assertEquals(Escaper.escapePathSegment("$*"), "$$*");
    assertEquals(Escaper.escapePathSegment(PathSpec.WILDCARD), "$*");
  }