コード例 #1
0
 @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("[", ", ", "]"));
 }
コード例 #2
0
  @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());
  }
コード例 #3
0
  @Test
  public void appendString_with_separator() {
    ImmutableBag<String> bag = this.newBag();

    Appendable builder = new StringBuilder();
    bag.appendString(builder, ", ");
    Assert.assertEquals(bag.toString(), '[' + builder.toString() + ']');
  }