package com.github.moreaunicolas.util;

import org.junit.Test;

import java.util.NoSuchElementException;

import static com.google.common.collect.Iterators.singletonIterator;
import static java.util.Collections.emptyEnumeration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;

public class EnumerationAsIteratorTests {

    @Test
    public void constructorThrowsWhenCalledWithNullEnumeration() {
        Throwable caught = catchThrowable(() -> new EnumerationAsIterator<>(null));

        assertThat(caught).isInstanceOf(NullPointerException.class);
    }

    @Test
    public void hasNextReturnsFalseWhenEnumerationHasNoMoreElements() {
        EnumerationAsIterator<Object> iterator = new EnumerationAsIterator<>(emptyEnumeration());

        assertThat(iterator.hasNext()).isFalse();
    }

    @Test
    public void hasNextReturnsTrueWhenEnumerationHasMoreElements() {
        EnumerationAsIterator<Object> iterator = new EnumerationAsIterator<>(singletonEnumeration());

        assertThat(iterator.hasNext()).isTrue();
    }

    @Test
    public void nextReturnsTheNextElementWhenThereIsOne() {
        EnumerationAsIterator<Object> iterator = new EnumerationAsIterator<>(singletonEnumeration());

        assertThat(iterator.next()).isEqualTo("test");
    }

    @Test
    public void nextThrowsWhenThereIsNoMoreElements() {
        EnumerationAsIterator<Object> iterator = new EnumerationAsIterator<>(emptyEnumeration());

        Throwable caught = catchThrowable(iterator::next);

        assertThat(caught).isInstanceOf(NoSuchElementException.class);
    }

    private static IteratorAsEnumeration<Object> singletonEnumeration() {
        return new IteratorAsEnumeration<>(singletonIterator("test"));
    }
}
@@ -1634,24 +1634,346 @@
 ss);%0A    %7D%0A%0A
+    @Test%0A    public void removeThrowsUnsupportedOperationException() %7B%0A        EnumerationAsIterator%3CObject%3E iterator = new EnumerationAsIterator%3C%3E(singletonEnumeration());%0A%0A        Throwable caught = catchThrowable(iterator::remove);%0A%0A        assertThat(caught).isInstanceOf(UnsupportedOperationException.class);%0A    %7D%0A%0A
     private 

Add missing EnumerationAsIterator.remove() test