/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2017-2018 Yegor Bugayenko
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package org.cactoos.list;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import org.junit.Test;

/**
 * Test case for {@link ListEnvelope}.
 *
 * @since 0.32
 * @checkstyle JavadocMethodCheck (500 lines)
 */
public final class ListEnvelopeTest {

    @Test(expected = UnsupportedOperationException.class)
    public void returnsListIteratorWithUnsupportedRemove() {
        final ListEnvelope<String> list = new ListEnvelope<String>(
            () -> {
                final List<String> inner = new LinkedList<>();
                inner.add("one");
                return inner;
            }
        ) {
        };
        final Iterator<String> iterator = list.listIterator();
        iterator.next();
        iterator.remove();
    }

    @Test(expected = UnsupportedOperationException.class)
    public void returnsListIteratorWithUnsupportedSet() {
        final ListEnvelope<String> list = new ListEnvelope<String>(
            () -> {
                final List<String> inner = new LinkedList<>();
                inner.add("three");
                return inner;
            }
        ) {
        };
        final ListIterator<String> iterator = list.listIterator();
        iterator.next();
        iterator.set("zero");
    }

    @Test(expected = UnsupportedOperationException.class)
    public void returnsListIteratorWithUnsupportedAdd() {
        final ListEnvelope<String> list = new ListEnvelope<String>(
            () -> {
                final List<String> inner = new LinkedList<>();
                inner.add("ten");
                return inner;
            }
        ) {
        };
        final ListIterator<String> iterator = list.listIterator();
        iterator.next();
        iterator.add("twenty");
    }
}

@@ -1280,24 +1280,93 @@
 stIterator;%0A
+import org.hamcrest.MatcherAssert;%0Aimport org.hamcrest.core.IsEqual;%0A
 import org.j
@@ -1376,16 +1376,16 @@
 t.Test;%0A
-
 %0A/**%0A * 
@@ -1484,16 +1484,60 @@
  lines)%0A
+ * @checkstyle MagicNumberCheck (500 lines)%0A
  */%0Apubl
@@ -2502,33 +2502,9 @@
 tor(
-);%0A        iterator.next(
+1
 );%0A 
@@ -2991,32 +2991,32 @@
 terator.next();%0A
-
         iterator
@@ -3036,11 +3036,984 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void getsPreviousIndex() %7B%0A        MatcherAssert.assertThat(%0A            %22List iterator returns incorrect previous index%22,%0A            new ListOf%3C%3E(1).listIterator().previousIndex(),%0A            new IsEqual%3C%3E(-1)%0A        );%0A    %7D%0A%0A    @Test%0A    public void getsPrevious() %7B%0A        MatcherAssert.assertThat(%0A            %22List iterator returns incorrect previous item%22,%0A            new ListOf%3C%3E(3, 7).listIterator(1).previous(),%0A            new IsEqual%3C%3E(3)%0A        );%0A    %7D%0A%0A    @Test%0A    public void getsNextIndex() %7B%0A        MatcherAssert.assertThat(%0A            %22List iterator returns incorrect next index%22,%0A            new ListOf%3C%3E(1).listIterator().nextIndex(),%0A            new IsEqual%3C%3E(0)%0A        );%0A    %7D%0A%0A    @Test%0A    public void getsNext() %7B%0A        MatcherAssert.assertThat(%0A            %22List iterator returns incorrect next item%22,%0A            new ListOf%3C%3E(5, 11, 13).listIterator(1).next(),%0A            new IsEqual%3C%3E(11)%0A        );%0A    %7D
 %0A%7D%0A

Implement immutable ListIterator - improve test coverage