import "copyrightAndOthers.stg"
import "primitiveEquals.stg"
import "primitiveHashCode.stg"
import "primitiveLiteral.stg"

isTest() ::= "true"

skipBoolean() ::= "true"

targetPath() ::= "org/eclipse/collections/impl/lazy/primitive"

fileName(primitive) ::= "AbstractLazy<primitive.name>IterableTestCase"

class(primitive) ::= <<
<body(primitive.type, primitive.name)>
>>

body(type, name) ::= <<
<copyrightAndOthers()>

package org.eclipse.collections.impl.lazy.primitive;

import java.util.Arrays;
import java.util.NoSuchElementException;

import org.eclipse.collections.api.Lazy<name>Iterable;
import org.eclipse.collections.api.iterator.<name>Iterator;
import org.eclipse.collections.impl.bag.mutable.primitive.<name>HashBag;
import org.eclipse.collections.impl.block.factory.primitive.<name>Predicates;
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.factory.primitive.BooleanLists;
import org.eclipse.collections.impl.factory.primitive.ByteLists;
import org.eclipse.collections.impl.factory.primitive.CharLists;
import org.eclipse.collections.impl.factory.primitive.DoubleLists;
import org.eclipse.collections.impl.factory.primitive.FloatLists;
import org.eclipse.collections.impl.factory.primitive.IntLists;
import org.eclipse.collections.impl.factory.primitive.LongLists;
import org.eclipse.collections.impl.factory.primitive.ShortLists;
import org.eclipse.collections.impl.list.mutable.primitive.<name>ArrayList;
import org.eclipse.collections.impl.set.mutable.primitive.<name>HashSet;
import org.eclipse.collections.impl.string.immutable.CharAdapter;
import org.eclipse.collections.impl.test.Verify;
import org.junit.Assert;
import org.junit.Test;

/**
 * Abstract JUnit test for {@link Lazy<name>Iterable}.
 * This file was automatically generated from template file abstractLazyPrimitiveIterableTestCase.stg.
 */
public abstract class AbstractLazy<name>IterableTestCase
{
    protected abstract Lazy<name>Iterable classUnderTest();

    protected abstract Lazy<name>Iterable getEmptyIterable();

    protected abstract Lazy<name>Iterable newWith(<type> element1, <type> element2);

    @Test
    public void <type>Iterator()
    {
        <wideType.(type)> sum = <wideZero.(type)>;
        for (<name>Iterator iterator = this.classUnderTest().<type>Iterator(); iterator.hasNext(); )
        {
            sum += iterator.next();
        }
        Assert.assertEquals(<(wideLiteral.(type))("6")>, sum<(wideDelta.(type))>);
    }

    @Test(expected = NoSuchElementException.class)
    public void <type>Iterator_throws()
    {
        <name>Iterator iterator = this.classUnderTest().<type>Iterator();
        while (iterator.hasNext())
        {
            iterator.next();
        }

        iterator.next();
    }

    @Test
    public void forEach()
    {
        <wideType.(type)>[] sum = new <wideType.(type)>[1];
        this.classUnderTest().forEach(each -> sum[0] += each);
        Assert.assertEquals(<(wideLiteral.(type))("6")>, sum[0]<(wideDelta.(type))>);
    }

    @Test
    public void size()
    {
        Verify.assertSize(3, this.classUnderTest());
    }

    @Test
    public void isEmpty()
    {
        Verify.assertEmpty(this.getEmptyIterable());
        Verify.assertNotEmpty(this.classUnderTest());
    }

    @Test
    public void notEmpty()
    {
        Assert.assertFalse(this.getEmptyIterable().notEmpty());
        Assert.assertTrue(this.classUnderTest().notEmpty());
    }

    @Test
    public void count()
    {
        Assert.assertEquals(1L, this.classUnderTest().count(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Assert.assertEquals(0L, this.classUnderTest().count(<name>Predicates.lessThan(<(literal.(type))("0")>)));
        Assert.assertEquals(2L, this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).count(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Assert.assertEquals(2L, this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).count(<name>Predicates.lessThan(<(literal.(type))("34")>)));
        Assert.assertEquals(0L, this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).count(<name>Predicates.lessThan(<(literal.(type))("0")>)));
    }

    @Test
    public void anySatisfy()
    {
        Assert.assertTrue(this.classUnderTest().anySatisfy(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Assert.assertFalse(this.classUnderTest().anySatisfy(<name>Predicates.greaterThan(<(literal.(type))("4")>)));
        Assert.assertTrue(this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).anySatisfy(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Assert.assertFalse(this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).anySatisfy(<name>Predicates.lessThan(<(literal.(type))("0")>)));
        Assert.assertFalse(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).anySatisfy(<name>Predicates.lessThan(<(literal.(type))("0")>)));
        Assert.assertTrue(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).anySatisfy(<name>Predicates.lessThan(<(literal.(type))("33")>)));
    }

    @Test
    public void allSatisfy()
    {
        Assert.assertTrue(this.classUnderTest().allSatisfy(<name>Predicates.greaterThan(<(literal.(type))("0")>)));
        Assert.assertFalse(this.classUnderTest().allSatisfy(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Assert.assertFalse(this.classUnderTest().allSatisfy(<name>Predicates.lessThan(<(literal.(type))("1")>)));
        Assert.assertTrue(this.classUnderTest().allSatisfy(<name>Predicates.lessThan(<(literal.(type))("4")>)));
        Assert.assertTrue(this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).allSatisfy(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Assert.assertFalse(this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).allSatisfy(<name>Predicates.lessThan(<(literal.(type))("1")>)));
        Assert.assertFalse(this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).allSatisfy(<name>Predicates.lessThan(<(literal.(type))("0")>)));
        Assert.assertFalse(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).allSatisfy(<name>Predicates.lessThan(<(literal.(type))("1")>)));
        Assert.assertFalse(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).allSatisfy(<name>Predicates.lessThan(<(literal.(type))("33")>)));
        Assert.assertTrue(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).allSatisfy(<name>Predicates.lessThan(<(literal.(type))("34")>)));
    }

    @Test
    public void noneSatisfy()
    {
        Assert.assertTrue(this.classUnderTest().noneSatisfy(<name>Predicates.lessThan(<(literal.(type))("0")>)));
        Assert.assertFalse(this.classUnderTest().noneSatisfy(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Assert.assertTrue(this.classUnderTest().noneSatisfy(<name>Predicates.lessThan(<(literal.(type))("1")>)));
        Assert.assertTrue(this.classUnderTest().noneSatisfy(<name>Predicates.greaterThan(<(literal.(type))("4")>)));
        Assert.assertFalse(this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).noneSatisfy(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Assert.assertTrue(this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).noneSatisfy(<name>Predicates.lessThan(<(literal.(type))("0")>)));
        Assert.assertTrue(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).noneSatisfy(<name>Predicates.lessThan(<(literal.(type))("0")>)));
        Assert.assertFalse(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).noneSatisfy(<name>Predicates.lessThan(<(literal.(type))("33")>)));
    }

    @Test
    public void select()
    {
        Verify.assertSize(2, this.classUnderTest().select(<name>Predicates.greaterThan(<(literal.(type))("1")>)));
        Verify.assertEmpty(this.classUnderTest().select(<name>Predicates.lessThan(<(literal.(type))("0")>)));
        Verify.assertSize(2, this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).select(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Verify.assertEmpty(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).select(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Verify.assertSize(2, this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).select(<name>Predicates.lessThan(<(literal.(type))("34")>)));
    }

    @Test
    public void reject()
    {
        Verify.assertSize(1, this.classUnderTest().reject(<name>Predicates.greaterThan(<(literal.(type))("1")>)));
        Verify.assertEmpty(this.classUnderTest().reject(<name>Predicates.greaterThan(<(literal.(type))("0")>)));
        Verify.assertEmpty(this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).reject(<name>Predicates.lessThan(<(literal.(type))("2")>)));
        Verify.assertEmpty(this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).reject(<name>Predicates.lessThan(<(literal.(type))("34")>)));
        Verify.assertSize(2, this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).reject(<name>Predicates.lessThan(<(literal.(type))("2")>)));
    }

    @Test
    public void detectIfNone()
    {
        Assert.assertEquals(<(wideLiteral.(type))("1")>, this.classUnderTest().detectIfNone(<name>Predicates.lessThan(<(literal.(type))("4")>), <(literal.(type))("0")>)<(wideDelta.(type))>);
        Assert.assertEquals(<(wideLiteral.(type))("0")>, this.classUnderTest().detectIfNone(<name>Predicates.greaterThan(<(literal.(type))("3")>), <(literal.(type))("0")>)<(wideDelta.(type))>);
        Assert.assertEquals(<(wideLiteral.(type))("0")>, this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).detectIfNone(<name>Predicates.lessThan(<(literal.(type))("2")>), <(literal.(type))("1")>)<(wideDelta.(type))>);
        Assert.assertEquals(<(wideLiteral.(type))("33")>, this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">).detectIfNone(<name>Predicates.equal(<(literal.(type))("33")>), <(literal.(type))("1")>)<(wideDelta.(type))>);
        Assert.assertEquals(<(wideLiteral.(type))("32")>, this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).detectIfNone(<name>Predicates.equal(<(literal.(type))("33")>), <(literal.(type))("32")>)<(wideDelta.(type))>);
        Assert.assertEquals(<(wideLiteral.(type))("32")>, this.newWith(<["34", "35"]:(literal.(type))(); separator=", ">).detectIfNone(<name>Predicates.equal(<(literal.(type))("33")>), <(literal.(type))("32")>)<(wideDelta.(type))>);
    }

    @Test
    public void collect()
    {
        Verify.assertIterableSize(3, this.classUnderTest().collect(String::valueOf));
    }

    @Test
    public void tap()
    {
        StringBuilder tapStringBuilder = new StringBuilder();
        StringBuilder eachStringBuilder = new StringBuilder();
        Lazy<name>Iterable lazy = this.classUnderTest().tap(tapStringBuilder::append);
        Assert.assertEquals(lazy.makeString(""), tapStringBuilder.toString());
        lazy.tap(eachStringBuilder::append).forEach(eachStringBuilder::append);
        Assert.assertEquals(CharAdapter.adapt(eachStringBuilder.toString()).toBag(), CharAdapter.adapt(tapStringBuilder.toString()).toBag());
    }

    @Test
    public void flatCollect()
    {
        Verify.assertIterableSize(3, this.classUnderTest().flatCollect(Lists.mutable::with));
    }

    @Test
    public void lazyCollectPrimitives()
    {
        Assert.assertEquals(BooleanLists.immutable.of(false, true, false), this.classUnderTest().collectBoolean(e -> e % 2 == 0).toList());
        Assert.assertEquals(CharLists.immutable.of((char) 2, (char) 3, (char) 4), this.classUnderTest().asLazy().collectChar(e -> (char) (e + 1)).toList());
        Assert.assertEquals(ByteLists.immutable.of((byte) 2, (byte) 3, (byte) 4), this.classUnderTest().asLazy().collectByte(e -> (byte) (e + 1)).toList());
        Assert.assertEquals(ShortLists.immutable.of((short) 2, (short) 3, (short) 4), this.classUnderTest().asLazy().collectShort(e -> (short) (e + 1)).toList());
        Assert.assertEquals(IntLists.immutable.of(2, 3, 4), this.classUnderTest().asLazy().collectInt(e -> (int) (e + 1)).toList());
        Assert.assertEquals(FloatLists.immutable.of(2.0f, 3.0f, 4.0f), this.classUnderTest().asLazy().collectFloat(e -> (float) (e + 1)).toList());
        Assert.assertEquals(LongLists.immutable.of(2L, 3L, 4L), this.classUnderTest().asLazy().collectLong(e -> (long) (e + 1)).toList());
        Assert.assertEquals(DoubleLists.immutable.of(2.0, 3.0, 4.0), this.classUnderTest().asLazy().collectDouble(e -> (double) (e + 1)).toList());
    }

    @Test
    public void sum()
    {
        Assert.assertEquals(<(wideLiteral.(type))("6")>, this.classUnderTest().sum()<(wideDelta.(type))>);
        Assert.assertEquals(<(wideLiteral.(type))("1")>, this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).sum()<(wideDelta.(type))>);
        Assert.assertEquals(<(wideLiteral.(type))("33")>, this.newWith(<["0", "33"]:(literal.(type))(); separator=", ">).sum()<(wideDelta.(type))>);
    }

    @Test(expected = NoSuchElementException.class)
    public void max_throws_emptyIterable()
    {
        this.getEmptyIterable().max();
    }

    @Test(expected = NoSuchElementException.class)
    public void min_throws_emptyIterable()
    {
        this.getEmptyIterable().min();
    }

    @Test
    public void max()
    {
        Assert.assertEquals(<(literal.(type))("3")>, this.classUnderTest().max()<(wideDelta.(type))>);
        Assert.assertEquals(<(literal.(type))("33")>, this.newWith(<["33", "0"]:(literal.(type))(); separator=", ">).max()<(wideDelta.(type))>);
        Assert.assertEquals(<(literal.(type))("100")>, this.newWith(<["100", "1"]:(literal.(type))(); separator=", ">).max()<(wideDelta.(type))>);
        Assert.assertEquals(<(literal.(type))("2")>, this.newWith(<["1", "2"]:(literal.(type))(); separator=", ">).max()<(wideDelta.(type))>);
    }

    @Test
    public void min()
    {
        Assert.assertEquals(<(literal.(type))("1")>, this.classUnderTest().min()<(wideDelta.(type))>);
        Assert.assertEquals(<(literal.(type))("0")>, this.newWith(<["33", "0"]:(literal.(type))(); separator=", ">).min()<(wideDelta.(type))>);
        Assert.assertEquals(<(literal.(type))("1")>, this.newWith(<["100", "1"]:(literal.(type))(); separator=", ">).min()<(wideDelta.(type))>);
        Assert.assertEquals(<(literal.(type))("1")>, this.newWith(<["2", "1"]:(literal.(type))(); separator=", ">).min()<(wideDelta.(type))>);
    }

    @Test
    public void minIfEmpty()
    {
        Assert.assertEquals(<(literal.(type))("5")>, this.getEmptyIterable().minIfEmpty(<(literal.(type))("5")>)<(wideDelta.(type))>);
        Assert.assertEquals(<(literal.(type))("1")>, this.classUnderTest().minIfEmpty(<(literal.(type))("0")>)<(wideDelta.(type))>);
        Assert.assertEquals(
                <(literal.(type))("0")>,
                this.classUnderTest().select(<name>Predicates.lessThan(<(literal.(type))("0")>)).minIfEmpty(<(literal.(type))("0")>)<(wideDelta.(type))>);
    }

    @Test
    public void maxIfEmpty()
    {
        Assert.assertEquals(<(literal.(type))("5")>, this.getEmptyIterable().maxIfEmpty(<(literal.(type))("5")>)<(wideDelta.(type))>);
        Assert.assertEquals(<(literal.(type))("3")>, this.classUnderTest().maxIfEmpty(<(literal.(type))("0")>)<(wideDelta.(type))>);
        Assert.assertEquals(
                <(literal.(type))("0")>,
                this.classUnderTest().select(<name>Predicates.lessThan(<(literal.(type))("0")>)).maxIfEmpty(<(literal.(type))("0")>)<(wideDelta.(type))>);
    }

    @Test(expected = NoSuchElementException.class)
    public void maxThrowsOnEmpty()
    {
        new Lazy<name>IterableAdapter(new <name>ArrayList()).max();
    }

    @Test(expected = NoSuchElementException.class)
    public void minThrowsOnEmpty()
    {
        new Lazy<name>IterableAdapter(new <name>ArrayList()).min();
    }

    @Test
    public void average()
    {
        Assert.assertEquals(2.0d, this.classUnderTest().average(), 0.0);
    }

    @Test(expected = ArithmeticException.class)
    public void averageThrowsOnEmpty()
    {
        this.getEmptyIterable().average();
    }

    @Test
    public void median()
    {
        Assert.assertEquals(2.0d, this.classUnderTest().median(), 0.0);
        Assert.assertEquals(16.0d, this.newWith(<["1", "31"]:(literal.(type))(); separator=", ">).median(), 0.0);
    }

    @Test(expected = ArithmeticException.class)
    public void medianThrowsOnEmpty()
    {
        this.getEmptyIterable().median();
    }

    @Test
    public void toArray()
    {
        Assert.assertTrue(Arrays.equals(new <type>[]{<["0", "1"]:(literal.(type))(); separator=", ">}, this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).toArray())
                || Arrays.equals(new <type>[]{<["1", "0"]:(literal.(type))(); separator=", ">}, this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">).toArray()));
        Assert.assertTrue(Arrays.equals(new <type>[]{<["1", "31"]:(literal.(type))(); separator=", ">}, this.newWith(<["1", "31"]:(literal.(type))(); separator=", ">).toArray())
                || Arrays.equals(new <type>[]{<["31", "1"]:(literal.(type))(); separator=", ">}, this.newWith(<["1", "31"]:(literal.(type))(); separator=", ">).toArray()));
        Assert.assertTrue(Arrays.equals(new <type>[]{<["31", "35"]:(literal.(type))(); separator=", ">}, this.newWith(<["31", "35"]:(literal.(type))(); separator=", ">).toArray())
                || Arrays.equals(new <type>[]{<["35", "31"]:(literal.(type))(); separator=", ">}, this.newWith(<["31", "35"]:(literal.(type))(); separator=", ">).toArray()));
    }

    @Test
    public void contains()
    {
        Assert.assertTrue(this.classUnderTest().contains(<(literal.(type))("1")>));
        Assert.assertTrue(this.classUnderTest().contains(<(literal.(type))("2")>));
        Assert.assertTrue(this.classUnderTest().contains(<(literal.(type))("3")>));
        Assert.assertFalse(this.classUnderTest().contains(<(literal.(type))("4")>));
    }

    @Test
    public void containsAllArray()
    {
        Assert.assertTrue(this.classUnderTest().containsAll(<["1"]:(literal.(type))(); separator=", ">));
        Assert.assertTrue(this.classUnderTest().containsAll(<["2"]:(literal.(type))(); separator=", ">));
        Assert.assertTrue(this.classUnderTest().containsAll(<["1", "2"]:(literal.(type))(); separator=", ">));
        Assert.assertTrue(this.classUnderTest().containsAll(<["1", "2", "3"]:(literal.(type))(); separator=", ">));
        Assert.assertFalse(this.classUnderTest().containsAll(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">));
        Assert.assertFalse(this.classUnderTest().containsAll(<["4", "5", "6"]:(literal.(type))(); separator=", ">));
    }

    @Test
    public void containsAllIterable()
    {
        Assert.assertTrue(this.classUnderTest().containsAll(<name>ArrayList.newListWith(<["1"]:(literal.(type))(); separator=", ">)));
        Assert.assertTrue(this.classUnderTest().containsAll(<name>ArrayList.newListWith(<["2"]:(literal.(type))(); separator=", ">)));
        Assert.assertTrue(this.classUnderTest().containsAll(<name>ArrayList.newListWith(<["1", "2"]:(literal.(type))(); separator=", ">)));
        Assert.assertTrue(this.classUnderTest().containsAll(<name>ArrayList.newListWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">)));
        Assert.assertFalse(this.classUnderTest().containsAll(<name>ArrayList.newListWith(<["1", "2", "3", "4"]:(literal.(type))(); separator=", ">)));
        Assert.assertFalse(this.classUnderTest().containsAll(<name>ArrayList.newListWith(<["4", "5", "6"]:(literal.(type))(); separator=", ">)));
    }

    @Test
    public void testToString()
    {
        Lazy<name>Iterable iterable = this.newWith(<["1", "2"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue("[<["1", "2"]:(toStringLiteral.(type))(); separator=", ">]".equals(iterable.toString())
                || "[<["2", "1"]:(toStringLiteral.(type))(); separator=", ">]".equals(iterable.toString()));

        Lazy<name>Iterable iterable1 = this.newWith(<["0", "31"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(
                iterable1.toString(),
                iterable1.toString().equals("[<["0", "31"]:(toStringLiteral.(type))(); separator=", ">]")
                        || iterable1.toString().equals("[<["31", "0"]:(toStringLiteral.(type))(); separator=", ">]"));

        Lazy<name>Iterable iterable2 = this.newWith(<["31", "32"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(
                iterable2.toString(),
                iterable2.toString().equals("[<["31", "32"]:(toStringLiteral.(type))(); separator=", ">]")
                        || iterable2.toString().equals("[<["32", "31"]:(toStringLiteral.(type))(); separator=", ">]"));

        Lazy<name>Iterable iterable3 = this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(
                iterable3.toString(),
                iterable3.toString().equals("[<["32", "33"]:(toStringLiteral.(type))(); separator=", ">]")
                        || iterable3.toString().equals("[<["33", "32"]:(toStringLiteral.(type))(); separator=", ">]"));

        Lazy<name>Iterable iterable4 = this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(
                iterable4.toString(),
                iterable4.toString().equals("[<["0", "1"]:(toStringLiteral.(type))(); separator=", ">]")
                        || iterable4.toString().equals("[<["1", "0"]:(toStringLiteral.(type))(); separator=", ">]"));
    }

    @Test
    public void makeString()
    {
        Lazy<name>Iterable iterable1 = this.newWith(<["0", "31"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(
                iterable1.makeString(),
                iterable1.makeString().equals("<["0", "31"]:(toStringLiteral.(type))(); separator=", ">")
                        || iterable1.makeString().equals("<["31", "0"]:(toStringLiteral.(type))(); separator=", ">"));

        Lazy<name>Iterable iterable2 = this.newWith(<["31", "32"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(
                iterable2.makeString("[", "/", "]"),
                iterable2.makeString("[", "/", "]").equals("[<["31", "32"]:(toStringLiteral.(type))(); separator="/">]")
                        || iterable2.makeString("[", "/", "]").equals("[<["32", "31"]:(toStringLiteral.(type))(); separator="/">]"));

        Lazy<name>Iterable iterable3 = this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(
                iterable3.makeString("/"),
                iterable3.makeString("/").equals("<["32", "33"]:(toStringLiteral.(type))(); separator="/">")
                        || iterable3.makeString("/").equals("<["33", "32"]:(toStringLiteral.(type))(); separator="/">"));

        Lazy<name>Iterable iterable4 = this.newWith(<["1", "2"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue("<["1", "2"]:(toStringLiteral.(type))(); separator=", ">".equals(iterable4.makeString())
                || "<["2", "1"]:(toStringLiteral.(type))(); separator=", ">".equals(iterable4.makeString()));
        Assert.assertTrue("<["1", "2"]:(toStringLiteral.(type))(); separator="/">".equals(iterable4.makeString("/"))
                || "<["2", "1"]:(toStringLiteral.(type))(); separator="/">".equals(iterable4.makeString("/")));
        Assert.assertTrue("[<["1", "2"]:(toStringLiteral.(type))(); separator="/">]".equals(iterable4.makeString("[", "/", "]"))
                || "[<["2", "1"]:(toStringLiteral.(type))(); separator="/">]".equals(iterable4.makeString("[", "/", "]")));

        Lazy<name>Iterable iterable5 = this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(
                iterable5.makeString(),
                iterable5.makeString().equals("<["0", "1"]:(toStringLiteral.(type))(); separator=", ">")
                        || iterable5.makeString().equals("<["1", "0"]:(toStringLiteral.(type))(); separator=", ">"));
        Assert.assertTrue(
                iterable5.makeString("[", "/", "]"),
                iterable5.makeString("[", "/", "]").equals("[<["0", "1"]:(toStringLiteral.(type))(); separator="/">]")
                        || iterable5.makeString("[", "/", "]").equals("[<["1", "0"]:(toStringLiteral.(type))(); separator="/">]"));
        Assert.assertTrue(
                iterable5.makeString("/"),
                iterable5.makeString("/").equals("<["0", "1"]:(toStringLiteral.(type))(); separator="/">")
                        || iterable5.makeString("/").equals("<["1", "0"]:(toStringLiteral.(type))(); separator="/">"));
    }

    @Test
    public void appendString()
    {
        StringBuilder appendable2 = new StringBuilder();
        Lazy<name>Iterable iterable = this.newWith(<["1", "2"]:(literal.(type))(); separator=", ">);
        iterable.appendString(appendable2);
        Assert.assertTrue("<["1", "2"]:(toStringLiteral.(type))(); separator=", ">".equals(appendable2.toString())
                || "<["2", "1"]:(toStringLiteral.(type))(); separator=", ">".equals(appendable2.toString()));
        StringBuilder appendable3 = new StringBuilder();
        iterable.appendString(appendable3, "/");
        Assert.assertTrue("<["1", "2"]:(toStringLiteral.(type))(); separator="/">".equals(appendable3.toString())
                || "<["2", "1"]:(toStringLiteral.(type))(); separator="/">".equals(appendable3.toString()));
        StringBuilder appendable4 = new StringBuilder();
        iterable.appendString(appendable4, "[", ", ", "]");
        Assert.assertEquals(iterable.toString(), appendable4.toString());

        StringBuilder appendable7 = new StringBuilder();
        Lazy<name>Iterable iterable1 = this.newWith(<["0", "31"]:(literal.(type))(); separator=", ">);
        iterable1.appendString(appendable7);
        Assert.assertTrue(appendable7.toString(), "<["0", "31"]:(toStringLiteral.(type))(); separator=", ">".equals(appendable7.toString())
                || "<["31", "0"]:(toStringLiteral.(type))(); separator=", ">".equals(appendable7.toString()));

        StringBuilder appendable8 = new StringBuilder();
        Lazy<name>Iterable iterable2 = this.newWith(<["31", "32"]:(literal.(type))(); separator=", ">);
        iterable2.appendString(appendable8, "/");
        Assert.assertTrue(appendable8.toString(), "<["31", "32"]:(toStringLiteral.(type))(); separator="/">".equals(appendable8.toString())
                || "<["32", "31"]:(toStringLiteral.(type))(); separator="/">".equals(appendable8.toString()));

        StringBuilder appendable9 = new StringBuilder();
        Lazy<name>Iterable iterable4 = this.newWith(<["32", "33"]:(literal.(type))(); separator=", ">);
        iterable4.appendString(appendable9, "[", "/", "]");
        Assert.assertTrue(appendable9.toString(), "[<["32", "33"]:(toStringLiteral.(type))(); separator="/">]".equals(appendable9.toString())
                || "[<["33", "32"]:(toStringLiteral.(type))(); separator="/">]".equals(appendable9.toString()));

        StringBuilder appendable10 = new StringBuilder();
        Lazy<name>Iterable iterable5 = this.newWith(<["0", "1"]:(literal.(type))(); separator=", ">);
        iterable5.appendString(appendable10);
        Assert.assertTrue(appendable10.toString(), "<["0", "1"]:(toStringLiteral.(type))(); separator=", ">".equals(appendable10.toString())
                || "<["1", "0"]:(toStringLiteral.(type))(); separator=", ">".equals(appendable10.toString()));
        StringBuilder appendable11 = new StringBuilder();
        iterable5.appendString(appendable11, "/");
        Assert.assertTrue(appendable11.toString(), "<["0", "1"]:(toStringLiteral.(type))(); separator="/">".equals(appendable11.toString())
                || "<["1", "0"]:(toStringLiteral.(type))(); separator="/">".equals(appendable11.toString()));
        StringBuilder appendable12 = new StringBuilder();
        iterable5.appendString(appendable12, "[", "/", "]");
        Assert.assertTrue(appendable12.toString(), "[<["0", "1"]:(toStringLiteral.(type))(); separator="/">]".equals(appendable12.toString())
                || "[<["1", "0"]:(toStringLiteral.(type))(); separator="/">]".equals(appendable12.toString()));
    }

    @Test
    public void toList()
    {
        Lazy<name>Iterable iterable = this.newWith(<["31", "32"]:(literal.(type))(); separator=", ">);
        Assert.assertTrue(<name>ArrayList.newListWith(<["31", "32"]:(literal.(type))(); separator=", ">).equals(iterable.toList())
                || <name>ArrayList.newListWith(<["32", "31"]:(literal.(type))(); separator=", ">).equals(iterable.toList()));
    }

    @Test
    public void toSortedArray()
    {
        Assert.assertArrayEquals(new <type>[]{1, 2, 3}, this.classUnderTest().toSortedArray()<(delta.(type))>);
    }

    @Test
    public void toSortedList()
    {
        Assert.assertEquals(<name>ArrayList.newListWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), this.classUnderTest().toSortedList());
    }

    @Test
    public void toSet()
    {
        Assert.assertEquals(<name>HashSet.newSetWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), this.classUnderTest().toSet());
    }

    @Test
    public void toBag()
    {
        Assert.assertEquals(<name>HashBag.newBagWith(<["1", "2", "3"]:(literal.(type))(); separator=", ">), this.classUnderTest().toBag());
    }

    @Test
    public void asLazy()
    {
        Lazy<name>Iterable iterable = this.classUnderTest();
        Assert.assertEquals(iterable.toSet(), iterable.asLazy().toSet());
        Verify.assertInstanceOf(Lazy<name>Iterable.class, iterable.asLazy());
        Assert.assertSame(iterable, iterable.asLazy());
    }
}

>>
