import "copyright.stg"
import "primitiveEquals.stg"
import "primitiveHashCode.stg"
import "primitiveLiteral.stg"

isTest() ::= "true"

skipBoolean() ::= "true"

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

fileName(primitive) ::= "Immutable<primitive.name>BooleanSingletonMapTest"

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

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

package org.eclipse.collections.impl.map.immutable.primitive;

import java.util.NoSuchElementException;

import org.eclipse.collections.api.BooleanIterable;
import org.eclipse.collections.api.iterator.BooleanIterator;
import org.eclipse.collections.api.map.primitive.<name>BooleanMap;
import org.eclipse.collections.api.map.primitive.Immutable<name>BooleanMap;
import org.eclipse.collections.impl.block.factory.primitive.BooleanPredicates;
import org.eclipse.collections.impl.factory.primitive.BooleanBags;
import org.eclipse.collections.impl.factory.primitive.<name>BooleanMaps;
import org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList;
import org.eclipse.collections.impl.list.mutable.primitive.<name>ArrayList;
import org.eclipse.collections.impl.map.mutable.primitive.<name>BooleanHashMap;
import org.junit.Assert;
import org.junit.Test;

/**
 * JUnit test for {@link Immutable<name>BooleanSingletonMap}.
 * This file was automatically generated from template file immutablePrimitiveBooleanSingletonMapTest.stg.
 */
public class Immutable<name>BooleanSingletonMapTest extends AbstractImmutable<name>BooleanMapTestCase
{
    @Override
    protected Immutable<name>BooleanMap classUnderTest()
    {
        return <name>BooleanMaps.immutable.with(<(literal.(type))("0")>, true);
    }

    @Test
    public void newWithKeyValue()
    {
        Immutable<name>BooleanMap map1 = this.classUnderTest();
        Immutable<name>BooleanMap expected = this.newWithKeysValues(<(literal.(type))("0")>, true, <(literal.(type))("1")>, true);
        Assert.assertEquals(expected, map1.newWithKeyValue(<(literal.(type))("1")>, true));
        Assert.assertNotSame(map1, map1.newWithKeyValue(<(literal.(type))("1")>, true));
    }

    @Test
    public void newWithoutKeyValue()
    {
        Immutable<name>BooleanMap map1 = this.classUnderTest();
        Assert.assertEquals(map1, map1.newWithoutKey(<(literal.(type))("32")>));
        Assert.assertSame(map1, map1.newWithoutKey(<(literal.(type))("32")>));
        Assert.assertEquals(this.classUnderTest(), map1);

        Immutable<name>BooleanMap map2 = this.classUnderTest();
        Assert.assertEquals(this.getEmptyMap(), map2.newWithoutKey(<(literal.(type))("0")>));
        Assert.assertNotSame(map2, map2.newWithoutKey(<(literal.(type))("0")>));
        Assert.assertEquals(this.classUnderTest(), map2);
    }

    @Test
    public void newWithoutAllKeys()
    {
        Immutable<name>BooleanMap map1 = this.classUnderTest();
        Assert.assertEquals(this.getEmptyMap(), map1.newWithoutAllKeys(<name>ArrayList.newListWith(<(literal.(type))("0")>, <(literal.(type))("32")>)));
        Assert.assertNotSame(map1, map1.newWithoutAllKeys(<name>ArrayList.newListWith(<(literal.(type))("0")>, <(literal.(type))("32")>)));
        Assert.assertEquals(this.classUnderTest(), map1);

        Immutable<name>BooleanMap map2 = this.classUnderTest();
        Assert.assertEquals(map2, map2.newWithoutAllKeys(<name>ArrayList.newListWith(<(literal.(type))("31")>, <(literal.(type))("32")>)));
        Assert.assertEquals(this.classUnderTest(), map2);
    }

    @Override
    @Test
    public void containsValue()
    {
        Assert.assertTrue(this.classUnderTest().containsValue(true));
        Assert.assertFalse(this.classUnderTest().containsValue(false));
    }

    @Override
    @Test
    public void contains()
    {
        Assert.assertTrue(this.classUnderTest().contains(true));
        Assert.assertFalse(this.classUnderTest().contains(false));
    }

    @Override
    @Test
    public void getIfAbsent()
    {
        Assert.assertTrue(this.classUnderTest().getIfAbsent(<(literal.(type))("0")>, false));
        Assert.assertTrue(this.classUnderTest().getIfAbsent(<(literal.(type))("31")>, true));
        Assert.assertFalse(this.classUnderTest().getIfAbsent(<(literal.(type))("32")>, false));
    }

    @Override
    @Test
    public void asLazy()
    {
        Assert.assertEquals(BooleanArrayList.newListWith(true), this.classUnderTest().asLazy().toList());
    }

    @Override
    @Test
    public void booleanIterator()
    {
        BooleanIterator iterator = this.classUnderTest().booleanIterator();
        Assert.assertTrue(iterator.hasNext());
        Assert.assertTrue(iterator.next());
        Assert.assertFalse(iterator.hasNext());
        Assert.assertThrows(NoSuchElementException.class, iterator::next);
    }

    @Override
    @Test
    public void getOrThrow()
    {
        Assert.assertTrue(this.classUnderTest().getOrThrow(<(literal.(type))("0")>));

        Assert.assertThrows(IllegalStateException.class, () -> this.classUnderTest().getOrThrow(<(literal.(type))("31")>));
        Assert.assertThrows(IllegalStateException.class, () -> this.classUnderTest().getOrThrow(<(literal.(type))("32")>));
    }

    @Override
    @Test
    public void get()
    {
        Assert.assertTrue(this.classUnderTest().get(<(literal.(type))("0")>));
        Assert.assertFalse(this.classUnderTest().get(<(literal.(type))("31")>));
        Assert.assertFalse(this.classUnderTest().get(<(literal.(type))("32")>));
    }

    @Override
    @Test
    public void containsAll()
    {
        Assert.assertFalse(this.classUnderTest().containsAll(true, false));
        Assert.assertFalse(this.classUnderTest().containsAll(false));
        Assert.assertTrue(this.classUnderTest().containsAll(true));
        Assert.assertTrue(this.classUnderTest().containsAll());
    }

    @Override
    @Test
    public void containsKey()
    {
        Assert.assertTrue(this.classUnderTest().containsKey(<(literal.(type))("0")>));
        Assert.assertFalse(this.classUnderTest().containsKey(<(literal.(type))("31")>));
        Assert.assertFalse(this.classUnderTest().containsKey(<(literal.(type))("32")>));
    }

    @Override
    @Test
    public void keysView()
    {
        Assert.assertEquals(<name>ArrayList.newListWith(<(literal.(type))("0")>), this.classUnderTest().keysView().toSortedList());
    }

    @Override
    @Test
    public void containsAllIterable()
    {
        Assert.assertFalse(this.classUnderTest().containsAll(BooleanArrayList.newListWith(true, false)));
        Assert.assertFalse(this.classUnderTest().containsAll(BooleanArrayList.newListWith(false)));
        Assert.assertTrue(this.classUnderTest().containsAll(BooleanArrayList.newListWith(true)));
        Assert.assertTrue(this.classUnderTest().containsAll(new BooleanArrayList()));
    }

    @Override
    @Test
    public void anySatisfy()
    {
        Assert.assertTrue(this.classUnderTest().anySatisfy(BooleanPredicates.isTrue()));
        Assert.assertFalse(this.classUnderTest().anySatisfy(BooleanPredicates.isFalse()));
    }

    @Override
    @Test
    public void allSatisfy()
    {
        Assert.assertTrue(this.classUnderTest().allSatisfy(BooleanPredicates.isTrue()));
        Assert.assertFalse(this.classUnderTest().allSatisfy(BooleanPredicates.isFalse()));
    }

    @Override
    @Test
    public void noneSatisfy()
    {
        Assert.assertFalse(this.classUnderTest().noneSatisfy(BooleanPredicates.isTrue()));
        Assert.assertTrue(this.classUnderTest().noneSatisfy(BooleanPredicates.isFalse()));
    }

    @Override
    @Test
    public void select()
    {
        <name>BooleanMap actual1 = this.classUnderTest().select((<type> key, boolean value) -> <(equals.(type))("key", {<(literal.(type))("0")>})>);
        Assert.assertEquals(<name>BooleanHashMap.newWithKeysValues(<(literal.(type))("0")>, true), actual1);
        <name>BooleanMap actual2 = this.classUnderTest().select((<type> key, boolean value) -> <(equals.(type))("key", {<(literal.(type))("1")>})>);
        Assert.assertEquals(this.getEmptyMap(), actual2);
    }

    @Override
    @Test
    public void reject()
    {
        <name>BooleanMap actual1 = this.classUnderTest().reject((<type> key, boolean value) -> <(equals.(type))("key", {<(literal.(type))("1")>})>);
        Assert.assertEquals(<name>BooleanHashMap.newWithKeysValues(<(literal.(type))("0")>, true), actual1);
        <name>BooleanMap actual2 = this.classUnderTest().reject((<type> key, boolean value) -> <(equals.(type))("key", {<(literal.(type))("0")>})>);
        Assert.assertEquals(this.getEmptyMap(), actual2);
    }

    @Override
    @Test
    public void select_value()
    {
        BooleanIterable actual1 = this.classUnderTest().select(BooleanPredicates.isFalse());
        Assert.assertEquals(BooleanBags.immutable.empty(), actual1);

        BooleanIterable actual2 = this.classUnderTest().select(BooleanPredicates.isTrue());
        Assert.assertEquals(BooleanBags.immutable.with(true), actual2);
    }

    @Override
    @Test
    public void reject_value()
    {
        BooleanIterable actual1 = this.classUnderTest().reject(BooleanPredicates.isTrue());
        Assert.assertEquals(BooleanBags.immutable.empty(), actual1);

        BooleanIterable actual2 = this.classUnderTest().reject(BooleanPredicates.isFalse());
        Assert.assertEquals(BooleanBags.immutable.with(true), actual2);
    }

    @Override
    @Test
    public void count()
    {
        Assert.assertEquals(0, this.classUnderTest().count(BooleanPredicates.isFalse()));
        Assert.assertEquals(1, this.classUnderTest().count(BooleanPredicates.isTrue()));
    }
}

>>
