public static String trimQueueName(String name) {
    if (name == null) {
      return null;
    }
    int start = 0;
    while (start < name.length()
        && isWhitespace(name.charAt(start))
        && start < name.length()) {
      start++;
    }
    int end = name.length() - 1;
    while (end >= 0
        && isWhitespace(name.charAt(end))
        && end > start) {
      end--;
    }
    return name.substring(start, end+1);
  }
@Test
  public void testTrimQueueNamesEmpty() throws Exception {
    assertNull(trimQueueName(null));
    final String spaces = "\u2002\u3000\r\u0085\u200A\u2005\u2000\u3000"
        + "\u2029\u000B\u3000\u2008\u2003\u205F\u3000\u1680"
        + "\u0009\u0020\u2006\u2001\u202F\u00A0\u000C\u2009"
        + "\u3000\u2004\u3000\u3000\u2028\n\u2007\u3000";
    assertTrue(trimQueueName(spaces).isEmpty());
  }