@@ -0,0 +1,2687 @@
+package com.github.davidmoten.rx.operators;%0A%0Aimport static java.util.Arrays.asList;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.util.List;%0A%0Aimport org.junit.Test;%0A%0Aimport rx.Observable;%0Aimport rx.observers.TestSubscriber;%0A%0Aimport com.github.davidmoten.rx.Transformers;%0A%0Apublic class TransformerStateMachineTest %7B%0A    @SuppressWarnings(%22unchecked%22)%0A    @Test%0A    public void testToListUntilChanged() %7B%0A        Observable%3CInteger%3E o = Observable.just(1, 1, 1, 2, 2, 3);%0A        List%3CList%3CInteger%3E%3E lists = o.compose(Transformers.%3CInteger%3E toListUntilChanged())%0A        // get as list%0A                .toList().toBlocking().single();%0A        assertEquals(asList(asList(1, 1, 1), asList(2, 2), asList(3)), lists);%0A    %7D%0A%0A    @Test%0A    public void testToListUntilChangedMultipleAtEnd() %7B%0A        Observable%3CInteger%3E o = Observable.just(1, 1, 1, 2, 2, 3, 3);%0A        List%3CList%3CInteger%3E%3E lists = o.compose(Transformers.%3CInteger%3E toListUntilChanged())%0A        // get as list%0A                .toList().toBlocking().single();%0A        assertEquals(asList(asList(1, 1, 1), asList(2, 2), asList(3, 3)), lists);%0A    %7D%0A%0A    @Test%0A    public void testToListUntilChangedWithEmpty() %7B%0A        Observable%3CInteger%3E o = Observable.empty();%0A        List%3CList%3CInteger%3E%3E lists = o.compose(Transformers.%3CInteger%3E toListUntilChanged())%0A        // get as list%0A                .toList().toBlocking().single();%0A        assertTrue(lists.isEmpty());%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    @Test%0A    public void testToListUntilChangedWithNoChange() %7B%0A        Observable%3CInteger%3E o = Observable.just(1, 1, 1);%0A        List%3CList%3CInteger%3E%3E lists = o.compose(Transformers.%3CInteger%3E toListUntilChanged())%0A        // get as list%0A                .toList().toBlocking().single();%0A        assertEquals(asList(asList(1, 1, 1)), lists);%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    @Test%0A    public void testToListUntilChangedWithOnlyChange() %7B%0A        Observable%3CInteger%3E o = Observable.just(1, 2, 3);%0A        List%3CList%3CInteger%3E%3E lists = o.compose(Transformers.%3CInteger%3E toListUntilChanged())%0A        // get as list%0A                .toList().toBlocking().single();%0A        assertEquals(asList(asList(1), asList(2), asList(3)), lists);%0A    %7D%0A%0A    @Test%0A    public void testToListUntilChangedWithError() %7B%0A        Exception ex = new Exception(%22boo%22);%0A        Observable%3CInteger%3E o = Observable.error(ex);%0A        TestSubscriber%3CList%3CInteger%3E%3E ts = new TestSubscriber%3CList%3CInteger%3E%3E();%0A        o.compose(Transformers.%3CInteger%3E toListUntilChanged()).subscribe(ts);%0A        ts.awaitTerminalEvent();%0A        ts.assertError(ex);%0A        ts.assertUnsubscribed();%0A    %7D%0A%0A%7D%0A

move tests and add error coverage test for state machine