@Test
public void testToStringWithLimit() throws Exception {

    assertThat(Utils.toStringWithLimit(null)).isEqualTo(Utils.NULL_STR);
    assertThat(Utils.toStringWithLimit("hi")).describedAs("Normal length string").isEqualTo("hi");
    StringBuilder sb = new StringBuilder();
    int SIZE = 1000;
    for (int i = 0; i < SIZE; i++) {
        sb.append("A");
    }
    assertThat(Utils.toStringWithLimit(sb.toString()).length()).describedAs("Long strings should be truncated").isLessThan(SIZE);
    assertThat(Utils.toStringWithLimit(sb.toString())).describedAs("String too long should be truncated").endsWith(Utils.DEFAULT_MAX_STRING_ENDING);
}