@Test public void shouldAllowTrimToMaximumLength() { String fittingThreeByteMessage = repeatCharacter("\u9faf", StringUtil.DB_MAX_STRING_LENGTH); String exceedingMessage = repeatCharacter("a", StringUtil.DB_MAX_STRING_LENGTH * 2); assertThat(fittingThreeByteMessage.substring(0, StringUtil.DB_MAX_STRING_LENGTH)).isEqualTo(StringUtil.trimToMaximumLengthAllowed(fittingThreeByteMessage)); assertThat(exceedingMessage.substring(0, StringUtil.DB_MAX_STRING_LENGTH)).isEqualTo(StringUtil.trimToMaximumLengthAllowed(exceedingMessage)); }
public static String trimToMaximumLengthAllowed(String string) { if (string != null && string.length() > DB_MAX_STRING_LENGTH) { return string.substring(0, DB_MAX_STRING_LENGTH); } return string; }
StringUtil { public static String trimToMaximumLengthAllowed(String string) { if (string != null && string.length() > DB_MAX_STRING_LENGTH) { return string.substring(0, DB_MAX_STRING_LENGTH); } return string; } }
StringUtil { public static String trimToMaximumLengthAllowed(String string) { if (string != null && string.length() > DB_MAX_STRING_LENGTH) { return string.substring(0, DB_MAX_STRING_LENGTH); } return string; }  }
StringUtil { public static String trimToMaximumLengthAllowed(String string) { if (string != null && string.length() > DB_MAX_STRING_LENGTH) { return string.substring(0, DB_MAX_STRING_LENGTH); } return string; }  static boolean isExpression(String text); static boolean isCompositeExpression(String text, ExpressionManager expressionManager); static String[] split(String text, String regex); static boolean hasAnySuffix(String text, String[] suffixes); static String fromBytes(byte[] bytes); static String fromBytes(byte[] bytes, ProcessEngine processEngine); static Reader readerFromBytes(byte[] bytes); static Writer writerForStream(OutputStream outStream); static byte[] toByteArray(String string); static byte[] toByteArray(String string, ProcessEngine processEngine); static String trimToMaximumLengthAllowed(String string); static String joinDbEntityIds(Collection<? extends DbEntity> dbEntities); static String joinProcessElementInstanceIds(Collection<? extends ProcessElementInstance> processElementInstances); static String join(Iterator<String> iterator); }
StringUtil { public static String trimToMaximumLengthAllowed(String string) { if (string != null && string.length() > DB_MAX_STRING_LENGTH) { return string.substring(0, DB_MAX_STRING_LENGTH); } return string; }  static boolean isExpression(String text); static boolean isCompositeExpression(String text, ExpressionManager expressionManager); static String[] split(String text, String regex); static boolean hasAnySuffix(String text, String[] suffixes); static String fromBytes(byte[] bytes); static String fromBytes(byte[] bytes, ProcessEngine processEngine); static Reader readerFromBytes(byte[] bytes); static Writer writerForStream(OutputStream outStream); static byte[] toByteArray(String string); static byte[] toByteArray(String string, ProcessEngine processEngine); static String trimToMaximumLengthAllowed(String string); static String joinDbEntityIds(Collection<? extends DbEntity> dbEntities); static String joinProcessElementInstanceIds(Collection<? extends ProcessElementInstance> processElementInstances); static String join(Iterator<String> iterator); static int DB_MAX_STRING_LENGTH; }