StringUtils { public static String trimToNull(String str) { String ts = trim(str); return isEmpty(ts) ? null : ts; }  static boolean isEmpty(String str); static boolean isContainEmpty(String... args); static boolean isBlank(String str); static String trimToNull(String str); static String trimToEmpty(String str); static String trim(String str); static boolean equals(String str1, String str2); static boolean equalsIgnoreCase(String str1, String str2); static boolean startsWith(String str, String prefix); static boolean startsWithIgnoreCase(String str, String prefix); static boolean isNumeric(String str); static String join(Collection<T> collection, String separator); static String join(Collection<T> collection, String separator,
                                StringFormatter<T> formatter); static final String EMPTY; }
@Test public void trimToNull() { Assert.assertNull(StringUtils.trimToNull(null)); Assert.assertEquals("foo", StringUtils.trimToNull("foo")); }