Search in sources :

Example 6 with ImmutableIntList

use of org.eclipse.collections.api.list.primitive.ImmutableIntList in project eclipse-collections by eclipse.

the class CodePointAdapterTest method appendString.

@Override
@Test
public void appendString() {
    StringBuilder expectedString = new StringBuilder("");
    StringBuilder expectedString1 = new StringBuilder("");
    int size = this.classUnderTest().size();
    for (int each = 0; each < size; each++) {
        expectedString.appendCodePoint(each + 1);
        expectedString1.appendCodePoint(each + 1);
        expectedString.append(each == size - 1 ? "" : ", ");
        expectedString1.append(each == size - 1 ? "" : "/");
    }
    ImmutableIntList list = this.classUnderTest();
    StringBuilder appendable2 = new StringBuilder();
    list.appendString(appendable2);
    Assert.assertEquals(expectedString.toString(), appendable2.toString());
    StringBuilder appendable3 = new StringBuilder();
    list.appendString(appendable3, "/");
    Assert.assertEquals(expectedString1.toString(), appendable3.toString());
}
Also used : ImmutableIntList(org.eclipse.collections.api.list.primitive.ImmutableIntList) Test(org.junit.Test)

Example 7 with ImmutableIntList

use of org.eclipse.collections.api.list.primitive.ImmutableIntList in project eclipse-collections by eclipse.

the class CodePointAdapterTest method appendStringAppendable.

@Test
public void appendStringAppendable() {
    StringBuilder expectedString = new StringBuilder();
    StringBuilder expectedString1 = new StringBuilder();
    int size = this.classUnderTest().size();
    for (int each = 0; each < size; each++) {
        expectedString.appendCodePoint(each + 1);
        expectedString1.appendCodePoint(each + 1);
        expectedString.append(each == size - 1 ? "" : ", ");
        expectedString1.append(each == size - 1 ? "" : "/");
    }
    ImmutableIntList list = this.classUnderTest();
    SBAppendable appendable2 = new SBAppendable();
    list.appendString(appendable2);
    Assert.assertEquals(expectedString.toString(), appendable2.toString());
    SBAppendable appendable3 = new SBAppendable();
    list.appendString(appendable3, "/");
    Assert.assertEquals(expectedString1.toString(), appendable3.toString());
}
Also used : ImmutableIntList(org.eclipse.collections.api.list.primitive.ImmutableIntList) Test(org.junit.Test)

Example 8 with ImmutableIntList

use of org.eclipse.collections.api.list.primitive.ImmutableIntList in project eclipse-collections by eclipse.

the class CodePointListTest method appendStringStringBuffer.

@SuppressWarnings("StringBufferMayBeStringBuilder")
@Test
public void appendStringStringBuffer() {
    StringBuffer expectedString = new StringBuffer("");
    StringBuffer expectedString1 = new StringBuffer("");
    int size = this.classUnderTest().size();
    for (int each = 0; each < size; each++) {
        expectedString.appendCodePoint(each + 1);
        expectedString1.appendCodePoint(each + 1);
        expectedString.append(each == size - 1 ? "" : ", ");
        expectedString1.append(each == size - 1 ? "" : "/");
    }
    ImmutableIntList list = this.classUnderTest();
    StringBuffer appendable2 = new StringBuffer();
    list.appendString(appendable2);
    Assert.assertEquals(expectedString.toString(), appendable2.toString());
    StringBuffer appendable3 = new StringBuffer();
    list.appendString(appendable3, "/");
    Assert.assertEquals(expectedString1.toString(), appendable3.toString());
    StringBuffer appendable4 = new StringBuffer();
    this.classUnderTest().appendString(appendable4, "", "", "");
    Assert.assertEquals(this.classUnderTest().toString(), appendable4.toString());
}
Also used : ImmutableIntList(org.eclipse.collections.api.list.primitive.ImmutableIntList) Test(org.junit.Test)

Example 9 with ImmutableIntList

use of org.eclipse.collections.api.list.primitive.ImmutableIntList in project eclipse-collections by eclipse.

the class CodePointListTest method appendStringAppendable.

@Test
public void appendStringAppendable() {
    StringBuilder expectedString = new StringBuilder();
    StringBuilder expectedString1 = new StringBuilder();
    int size = this.classUnderTest().size();
    for (int each = 0; each < size; each++) {
        expectedString.appendCodePoint(each + 1);
        expectedString1.appendCodePoint(each + 1);
        expectedString.append(each == size - 1 ? "" : ", ");
        expectedString1.append(each == size - 1 ? "" : "/");
    }
    ImmutableIntList list = this.classUnderTest();
    SBAppendable appendable2 = new SBAppendable();
    list.appendString(appendable2);
    Assert.assertEquals(expectedString.toString(), appendable2.toString());
    SBAppendable appendable3 = new SBAppendable();
    list.appendString(appendable3, "/");
    Assert.assertEquals(expectedString1.toString(), appendable3.toString());
    SBAppendable appendable4 = new SBAppendable();
    this.classUnderTest().appendString(appendable4, "", "", "");
    Assert.assertEquals(this.classUnderTest().toString(), appendable4.toString());
}
Also used : ImmutableIntList(org.eclipse.collections.api.list.primitive.ImmutableIntList) Test(org.junit.Test)

Example 10 with ImmutableIntList

use of org.eclipse.collections.api.list.primitive.ImmutableIntList in project eclipse-collections by eclipse.

the class CodePointListTest method makeString.

@Override
@Test
public void makeString() {
    ImmutableIntList list = this.classUnderTest();
    StringBuilder expectedString = new StringBuilder("");
    StringBuilder expectedString1 = new StringBuilder("");
    int size = list.size();
    for (int each = 0; each < size; each++) {
        expectedString.appendCodePoint(each + 1);
        expectedString1.appendCodePoint(each + 1);
        expectedString.append(each == size - 1 ? "" : ", ");
        expectedString1.append(each == size - 1 ? "" : "/");
    }
    Assert.assertEquals(expectedString.toString(), list.makeString());
    Assert.assertEquals(expectedString1.toString(), list.makeString("/"));
    Assert.assertEquals(this.classUnderTest().toString(), this.classUnderTest().makeString("", "", ""));
}
Also used : ImmutableIntList(org.eclipse.collections.api.list.primitive.ImmutableIntList) Test(org.junit.Test)

Aggregations

ImmutableIntList (org.eclipse.collections.api.list.primitive.ImmutableIntList)10 Test (org.junit.Test)10