public static String leftTruncate(@Nullable Object element, int maxLen) {
    if (element == null) {
      return "";
    }
    String s = element.toString();
    if (s.length() > maxLen) {
      return s.substring(0, maxLen) + "...";
    }
    return s;
  }
@Test
  public void testLeftTruncate() {
    assertEquals("", StringUtils.leftTruncate(null, 3));
    assertEquals("", StringUtils.leftTruncate("", 3));
    assertEquals("abc...", StringUtils.leftTruncate("abcd", 3));
  }