### Question:
SimonUtils { public static String compact(String input, int limitTo) { if (input == null || input.length() <= limitTo) { return input; } int headLength = limitTo / 2; int tailLength = limitTo - SHRINKED_STRING.length() - headLength; if (tailLength < 0) { tailLength = 1; } return input.substring(0, headLength) + SHRINKED_STRING + input.substring(input.length() - tailLength); } private  SimonUtils(); static String presentNanoTime(long nanos); static String presentNanoTime(double nanos); static String presentTimestamp(long timestamp); static String presentMinMaxCount(long minmax); static String simonTreeString(Simon simon); static String localName(String name); static boolean checkName(String name); static void validateSimonName(String name); static String generateNameForClass(String suffix); static String generateNameForClassAndMethod(String suffix); static String generateName(); static T doWithStopwatch(String name, Callable<T> callable); static void doWithStopwatch(String name, Runnable runnable); static String compact(String input, int limitTo); static StopwatchAggregate calculateStopwatchAggregate(Simon simon); static StopwatchAggregate calculateStopwatchAggregate(Simon simon, SimonFilter filter); static CounterAggregate calculateCounterAggregate(Simon simon); static CounterAggregate calculateCounterAggregate(Simon simon, SimonFilter filter); static final String NAME_PATTERN_CHAR_CLASS_CONTENT; static final Pattern NAME_PATTERN; static final String ALLOWED_CHARS; static final String MANAGER_SERVLET_CTX_ATTRIBUTE; }### Answer:
@Test public void testStringCompact() { Assert.assertEquals(SimonUtils.compact("asdfadfasd;a 345tw", 4), "as...w"); Assert.assertEquals(SimonUtils.compact("asdfadfasd;a 345tw", 7), "asd...w"); Assert.assertEquals(SimonUtils.compact("asdfadfasd;a 345tw", 12), "asdfad...5tw"); Assert.assertEquals(SimonUtils.compact("asdfadfasd;a 345tw", 17), "asdfadfa... 345tw"); Assert.assertEquals(SimonUtils.compact("asdfadfasd;a 345tw", 18), "asdfadfasd;a 345tw"); Assert.assertEquals(SimonUtils.compact("asdfadfasd;a 345tw", 30), "asdfadfasd;a 345tw"); }