sb.setLength(2); assertEquals("He", sb.toString()); sb.setLength(3); assertEquals("He\0", sb.toString());
    public void testSetLength() {        StrBuilder sb = new StrBuilder();        sb.append("Hello");        sb.setLength(2);        assertEquals("He", sb.toString());        try {            sb.setLength(-1);            fail("setLength(-1) expected StringIndexOutOfBoundsException");        } catch (StringIndexOutOfBoundsException e) {            // expected        }    }