@Test public void testTruncVal() { Assert.assertEquals(AmzaBotUtil.truncVal(null), ""); Assert.assertEquals(AmzaBotUtil.truncVal(""), ""); String nine = "123456789"; Assert.assertEquals(AmzaBotUtil.truncVal(nine), nine); String ten = "1234567890"; Assert.assertEquals(AmzaBotUtil.truncVal(ten), ten); String eleven = "12345678901"; Assert.assertEquals(AmzaBotUtil.truncVal(eleven), ten + "..."); }
public static String truncVal(String s) { if (s == null) { return ""; } int len = Math.min(s.length(), 10); String postfix = ""; if (s.length() > len) { postfix = "..."; } return s.substring(0, len) + postfix; }
AmzaBotUtil { public static String truncVal(String s) { if (s == null) { return ""; } int len = Math.min(s.length(), 10); String postfix = ""; if (s.length() > len) { postfix = "..."; } return s.substring(0, len) + postfix; } }
AmzaBotUtil { public static String truncVal(String s) { if (s == null) { return ""; } int len = Math.min(s.length(), 10); String postfix = ""; if (s.length() > len) { postfix = "..."; } return s.substring(0, len) + postfix; }  }
AmzaBotUtil { public static String truncVal(String s) { if (s == null) { return ""; } int len = Math.min(s.length(), 10); String postfix = ""; if (s.length() > len) { postfix = "..."; } return s.substring(0, len) + postfix; }  static String truncVal(String s); }
AmzaBotUtil { public static String truncVal(String s) { if (s == null) { return ""; } int len = Math.min(s.length(), 10); String postfix = ""; if (s.length() > len) { postfix = "..."; } return s.substring(0, len) + postfix; }  static String truncVal(String s);  }