@Test public void testTruncate() { assertEquals("Ham", AsicUtils.truncate("Hamburger", 3)); assertEquals("Olive", AsicUtils.truncate("Olive", 12)); assertEquals("", AsicUtils.truncate("", 1200)); assertEquals(null, AsicUtils.truncate(null, 0)); }
public static String truncate(String s, int max) { if (s == null) { return null; } if (s.length() > max) { return s.substring(0, max); } else { return s; } }
AsicUtils { public static String truncate(String s, int max) { if (s == null) { return null; } if (s.length() > max) { return s.substring(0, max); } else { return s; } } }
AsicUtils { public static String truncate(String s, int max) { if (s == null) { return null; } if (s.length() > max) { return s.substring(0, max); } else { return s; } } private  AsicUtils(); }
AsicUtils { public static String truncate(String s, int max) { if (s == null) { return null; } if (s.length() > max) { return s.substring(0, max); } else { return s; } } private  AsicUtils(); @SneakyThrows static String escapeString(String str); static String buildFailureOutput(Throwable cause); static String buildSuccessOutput(AsicContainerVerifier verifier); static String truncate(String s, int max); }
AsicUtils { public static String truncate(String s, int max) { if (s == null) { return null; } if (s.length() > max) { return s.substring(0, max); } else { return s; } } private  AsicUtils(); @SneakyThrows static String escapeString(String str); static String buildFailureOutput(Throwable cause); static String buildSuccessOutput(AsicContainerVerifier verifier); static String truncate(String s, int max);  }