// Path: redux-core/src/main/java/me/tatarka/redux/middleware/TestMiddleware.java
// public class TestMiddleware<S, A, R> implements Middleware<A, R> {
// 
//     private final Store<S> store;
//     private final List<A> actions = new ArrayList<>();
//     private final List<S> states = new ArrayList<>();
// 
//     public TestMiddleware(Store<S> store) {
//         this.store = store;
//         states.add(store.getState());
//     }
// 
//     @Override
//     public R dispatch(Next<A, R> next, A action) {
//         actions.add(action);
//         R result = next.next(action);
//         states.add(store.getState());
//         return result;
//     }
// 
//     /**
//      * Returns all actions that have been dispatched.
//      */
//     public List<A> actions() {
//         return Collections.unmodifiableList(actions);
//     }
// 
//     /**
//      * Returns all states. The first state is before any action has been dispatched. Each
//      * subsequent
//      * state is the state after each action.
//      */
//     public List<S> states() {
//         return Collections.unmodifiableList(states);
//     }
// 
//     /**
//      * Resets the middleware to only contain the current state and no actions.
//      */
//     public void reset() {
//         states.subList(0, states.size() - 1).clear();
//         actions.clear();
//     }
// }


import me.tatarka.redux.middleware.TestMiddleware;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.junit.Assert.assertEquals;
package me.tatarka.redux;




@RunWith(JUnit4.class)
public class ThunkDispatcherTest {

    @Test
    public void thunk_run_when_dispatched() {
        Thunk<String, String> thunk = new Thunk<String, String>() {
            @Override
            public void run(Dispatcher<String, String> dispatcher) {
                dispatcher.dispatch("action1");
                dispatcher.dispatch("action2");
            }
        };
        SimpleStore<String> store = new SimpleStore<>("test1");
// Path: redux-core/src/main/java/me/tatarka/redux/middleware/TestMiddleware.java
// public class TestMiddleware<S, A, R> implements Middleware<A, R> {
// 
//     private final Store<S> store;
//     private final List<A> actions = new ArrayList<>();
//     private final List<S> states = new ArrayList<>();
// 
//     public TestMiddleware(Store<S> store) {
//         this.store = store;
//         states.add(store.getState());
//     }
// 
//     @Override
//     public R dispatch(Next<A, R> next, A action) {
//         actions.add(action);
//         R result = next.next(action);
//         states.add(store.getState());
//         return result;
//     }
// 
//     /**
//      * Returns all actions that have been dispatched.
//      */
//     public List<A> actions() {
//         return Collections.unmodifiableList(actions);
//     }
// 
//     /**
//      * Returns all states. The first state is before any action has been dispatched. Each
//      * subsequent
//      * state is the state after each action.
//      */
//     public List<S> states() {
//         return Collections.unmodifiableList(states);
//     }
// 
//     /**
//      * Resets the middleware to only contain the current state and no actions.
//      */
//     public void reset() {
//         states.subList(0, states.size() - 1).clear();
//         actions.clear();
//     }
// }


// Path: redux-thunk/src/test/java/me/tatarka/redux/ThunkDispatcherTest.java
import me.tatarka.redux.middleware.TestMiddleware;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static org.junit.Assert.assertEquals;

package me.tatarka.redux;




@RunWith(JUnit4.class)
public class ThunkDispatcherTest {

    @Test
    public void thunk_run_when_dispatched() {
        Thunk<String, String> thunk = new Thunk<String, String>() {
            @Override
            public void run(Dispatcher<String, String> dispatcher) {
                dispatcher.dispatch("action1");
                dispatcher.dispatch("action2");
            }
        };
        SimpleStore<String> store = new SimpleStore<>("test1");
        TestMiddleware<String, String, String> testMiddleware = new TestMiddleware<>(store);