### Question:
Lang { public static String truncate(String str, int len) { if (str ==null) { return str; } int tLen = len - str.length(); if (tLen < 0) { return str.substring(0, len); } return str; }  static String RPAD(String str, int len); static String RPAD(String str, char c, int len); static String LPAD(String str, int len); static String LPAD(String str, char c, int len); static String truncate(String str, int len); static T NVL(T first, T second); static int linearSearch(Object[] oArray, Object obj); static int linearSearch(Iterable<?> oArray, Object obj); static boolean isInteger(String s); static boolean isDouble(String s); static String stringList(Object[] array, String separator); static String stringList(Iterable<?> array, String separator); static String dblStr(double x); static String milliStr(long milliseconds); static T setAtFill(List<T> list, int ndx, T item); static String getClasspath(); static void addPath(URLClassLoader urlClassLoader, URL u); static void loadedDependencies(String verboseclassOut); static String stackString(Throwable t); static String urlEncode(String preEncode); static String fullURLEncode(String preEncode); static String urlDecode(String encoded); static T error(Throwable t); static T deepCopy(T obj); static final String pWhite_Space; }### Answer:
@Test public void testTruncate() { assertEquals("ThisI", Lang.truncate("ThisIsAString", 5)); assertEquals("ThisI", Lang.truncate("ThisI", 5)); assertEquals("", Lang.truncate("", 5)); assertEquals(null, Lang.truncate(null, 5)); }