AttributedStringBuilder extends AttributedCharSequence implements Appendable { public static AttributedString append(CharSequence... strings) { AttributedStringBuilder sb = new AttributedStringBuilder(); for (CharSequence s : strings) { sb.append(s); } return sb.toAttributedString(); } AttributedStringBuilder();  AttributedStringBuilder(int capacity); static AttributedString append(CharSequence... strings); @Override int length(); @Override char charAt(int index); @Override AttributedStyle styleAt(int index); @Override AttributedString subSequence(int start, int end); @Override AttributedStringBuilder append(CharSequence csq); @Override AttributedStringBuilder append(CharSequence csq, int start, int end); @Override AttributedStringBuilder append(char c); AttributedStringBuilder append(CharSequence csq, AttributedStyle style); AttributedStringBuilder style(AttributedStyle style); AttributedStringBuilder style(Function<AttributedStyle,AttributedStyle> style); AttributedStringBuilder styled(Function<AttributedStyle,AttributedStyle> style, CharSequence cs); AttributedStringBuilder styled(AttributedStyle style, CharSequence cs); AttributedStringBuilder styled(Function<AttributedStyle,AttributedStyle> style, Consumer<AttributedStringBuilder> consumer); AttributedStyle style(); AttributedStringBuilder append(AttributedString str); AttributedStringBuilder append(AttributedString str, int start, int end); AttributedStringBuilder append(AttributedCharSequence str); AttributedStringBuilder append(AttributedCharSequence str, int start, int end); void appendAnsi(String ansi); AttributedStringBuilder ansiAppend(String ansi); void setLength(int l); AttributedStringBuilder tabs(int tabsize); AttributedStringBuilder tabs(List<Integer> tabs); AttributedStringBuilder styleMatches(Pattern pattern, AttributedStyle s); AttributedStringBuilder styleMatches(Pattern pattern, List<AttributedStyle> styles);  }
@Test public void testAppendNullToString() { AttributedStringBuilder sb = new AttributedStringBuilder(); String expected = ""; sb.append("foo"); expected += "foo"; sb.append((CharSequence) null); expected += "null"; assertEquals(expected, sb.toString()); sb.append("bar"); expected += "bar"; sb.append((CharSequence) null, 1, 3); expected += "ul"; assertEquals(expected, sb.toString()); }
@Test public void testUnsetTabSize() { AttributedStringBuilder sb; String expected = ""; sb = new AttributedStringBuilder(); sb.append("hello\tWorld"); expected += "hello\tWorld"; assertEquals(TAB_SIZE_ERR_MSG, expected, sb.toString()); }