package de.davherrmann.efficiently.app;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

import org.junit.Test;

import de.davherrmann.efficiently.immutable.Immutable;
import de.davherrmann.efficiently.server.Action;

public class MySpecialReducerTest
{
    private final Immutable<MySpecialState> emptyState = new Immutable<>(MySpecialState.class);
    private final MySpecialReducer reducer = new MySpecialReducer();
    private Immutable<MySpecialState> initialState = reducer.reduce(emptyState, emptyState.path(), action("initState"));
    @Test
    public void initialState() throws Exception
    {
        // given / then
        assertThat(initialState.asObject().assistant().currentPage(), is(2));
    }

    @Test
    public void nextPage() throws Exception
    {
        // given / when
        final Immutable<MySpecialState> state = reducer.reduce(initialState, initialState.path(),
            action("assistantAction", "next"));

        // then
        assertThat(state.asObject().assistant().currentPage(), is(3));
    }

    private Action action(final String type)
    {
        return new Action()
        {
            @Override
            public String type()
            {
                return type;
            }
        };
    }

    private Action action(final String type, final String actionId)
    {
        return new Action()
        {
            @Override
            public String type()
            {
                return type;
            }

            @Override
            public String actionId()
            {
                return actionId;
            }
        };
    }
}
@@ -962,12 +962,9 @@
 tion
-%22, %22
+/
 next
@@ -1213,32 +1213,32 @@
 )%0A            %7B%0A
+
                 
@@ -1284,369 +1284,6 @@
    %7D
-%0A%0A    private Action action(final String type, final String actionId)%0A    %7B%0A        return new Action()%0A        %7B%0A            @Override%0A            public String type()%0A            %7B%0A                return type;%0A            %7D%0A%0A            @Override%0A            public String actionId()%0A            %7B%0A                return actionId;%0A            %7D%0A        %7D;%0A    %7D
 %0A%7D

remove actionId, add meta map in Action