Extract StringUtil.truncate from ScalaTestGen