@@ -0,0 +1,2568 @@
+package no.ssb.vtl.script.operations.foreach;%0A%0Aimport com.google.common.collect.Iterators;%0Aimport com.google.common.collect.Lists;%0Aimport com.google.common.collect.PeekingIterator;%0Aimport org.junit.Test;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.Collections;%0Aimport java.util.Comparator;%0Aimport java.util.List;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.assertj.core.api.Assertions.assertThatThrownBy;%0A%0Apublic class MaxSelectorTest %7B%0A%0A    @Test%0A    public void testToString() %7B%0A%0A        MaxSelector%3CString%3E selector = new MaxSelector%3C%3E(%0A                Arrays.asList(%0A                        Iterators.peekingIterator(Iterators.forArray(%22a%22)),%0A                        Iterators.peekingIterator(Iterators.forArray(%22b%22)),%0A                        Iterators.peekingIterator(Iterators.forArray(%22c%22))%0A                ),%0A                Comparator.naturalOrder()%0A        );%0A        assertThat(selector.toString()).isEqualTo(%22MaxSelector%7BlastMax=null, comparator=INSTANCE%7D%22);%0A        selector.get();%0A        assertThat(selector.toString()).isEqualTo(%22MaxSelector%7BlastMax=c, comparator=INSTANCE%7D%22);%0A%0A    %7D%0A%0A    @Test%0A    public void testSelector() %7B%0A%0A        List%3CString%3E strings1 = new ArrayList%3C%3E();%0A        List%3CString%3E strings2 = new ArrayList%3C%3E();%0A        List%3CString%3E strings3 = new ArrayList%3C%3E();%0A        Lists.cartesianProduct(%0A                Arrays.asList(%22a%22, %22b%22, %22c%22),%0A                Arrays.asList(%22a%22, %22b%22, %22c%22),%0A                Arrays.asList(%22a%22, %22b%22, %22c%22)%0A        ).forEach(strings -%3E %7B%0A            strings1.add(strings.get(0));%0A            strings2.add(strings.get(1));%0A            strings3.add(strings.get(2));%0A        %7D);%0A%0A        PeekingIterator%3CString%3E it1 = Iterators.peekingIterator(strings1.iterator());%0A        PeekingIterator%3CString%3E it2 = Iterators.peekingIterator(strings2.iterator());%0A        PeekingIterator%3CString%3E it3 = Iterators.peekingIterator(strings3.iterator());%0A        MaxSelector%3CString%3E selector = new MaxSelector%3C%3E(%0A                Arrays.asList(it1, it2, it3),%0A                Comparator.naturalOrder()%0A        );%0A%0A        while (it1.hasNext() %7C%7C it2.hasNext() %7C%7C it3.hasNext()) %7B%0A            String max = Collections.max(Arrays.asList(it1.peek(), it2.peek(), it3.peek()));%0A            assertThat(selector.get()).contains(max);%0A            if (it1.hasNext()) %7B%0A                it1.next();%0A            %7D%0A            if (it2.hasNext()) %7B%0A                it2.next();%0A            %7D%0A            if (it3.hasNext()) %7B%0A                it3.next();%0A            %7D%0A        %7D%0A    %7D%0A%7D

Fix MaxSelector coverage