@Test public void makeString() { ImmutableBag<String> bag = this.newBag(); Assert.assertEquals(FastList.newList(bag).makeString(), bag.makeString()); Assert.assertEquals(bag.toString(), '[' + bag.makeString() + ']'); Assert.assertEquals(bag.toString(), '[' + bag.makeString(", ") + ']'); Assert.assertEquals(bag.toString(), bag.makeString("[", ", ", "]")); }
@Test public void appendString_with_start_separator_end() { ImmutableBag<String> bag = this.newBag(); Appendable builder = new StringBuilder(); bag.appendString(builder, "[", ", ", "]"); Assert.assertEquals(bag.toString(), builder.toString()); }
@Test public void appendString_with_separator() { ImmutableBag<String> bag = this.newBag(); Appendable builder = new StringBuilder(); bag.appendString(builder, ", "); Assert.assertEquals(bag.toString(), '[' + builder.toString() + ']'); }