### Question:
StringUtils { public static String abbreviate(String str, int maxWidth) { if (str == null) { return null; } if (maxWidth < 4) { throw new IllegalArgumentException("Minimum abbreviation width is 4"); } if (str.length() <= maxWidth) { return str; } return str.substring(0, maxWidth - 3) + "..."; } private  StringUtils(); static String abbreviate(String str, int maxWidth);  }### Answer:
@Test public void test() { try { assertEquals("123", StringUtils.abbreviate("123", 3)); fail("exception expected"); } catch (Exception e) { } assertNull(StringUtils.abbreviate(null, 5)); assertEquals("1234", StringUtils.abbreviate("1234", 5)); assertEquals("12345", StringUtils.abbreviate("12345", 5)); assertEquals("12...", StringUtils.abbreviate("123456", 5)); }