Search in sources :

Example 71 with Subscribe

use of com.squareup.otto.Subscribe in project FluxyAndroidTodo by armueller.

the class ActionCreatorTest method createSetTodoItemAsEditableActionTest.

@Test
public void createSetTodoItemAsEditableActionTest() {
    final AtomicBoolean testDone = new AtomicBoolean(false);
    actionBus.register(new Object() {

        @Subscribe
        public void addTodo(ViewAction action) {
            assertThat(action.getData().get(ViewAction.DataKeys.ID, -1)).isEqualTo(10);
            testDone.set(true);
        }
    });
    actionCreator.createSetTodoItemAsEditableAction(10);
    while (!testDone.get()) ;
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Subscribe(com.squareup.otto.Subscribe) Test(org.junit.Test)

Example 72 with Subscribe

use of com.squareup.otto.Subscribe in project FluxyAndroidTodo by armueller.

the class ActionCreatorTest method createToggleAllTodosCompleteActionTest.

@Test
public void createToggleAllTodosCompleteActionTest() {
    final AtomicBoolean testDone = new AtomicBoolean(false);
    actionBus.register(new Object() {

        @Subscribe
        public void addTodo(TodoAction action) {
            assertThat(action.getType()).isEqualTo(TodoAction.ActionTypes.TOGGLE_ALL);
            testDone.set(true);
        }
    });
    actionCreator.createToggleAllTodosCompleteAction();
    while (!testDone.get()) ;
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Subscribe(com.squareup.otto.Subscribe) Test(org.junit.Test)

Example 73 with Subscribe

use of com.squareup.otto.Subscribe in project FluxyAndroidTodo by armueller.

the class ActionCreatorTest method createDeleteAllCompleteTodosActionTest.

@Test
public void createDeleteAllCompleteTodosActionTest() {
    final AtomicBoolean testDone = new AtomicBoolean(false);
    actionBus.register(new Object() {

        @Subscribe
        public void addTodo(TodoAction action) {
            assertThat(action.getType()).isEqualTo(TodoAction.ActionTypes.DELETE_ALL);
            testDone.set(true);
        }
    });
    actionCreator.createDeleteAllCompleteTodosAction();
    while (!testDone.get()) ;
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Subscribe(com.squareup.otto.Subscribe) Test(org.junit.Test)

Example 74 with Subscribe

use of com.squareup.otto.Subscribe in project FluxyAndroidTodo by armueller.

the class ActionCreatorTest method createViewAllTodosActionTest.

@Test
public void createViewAllTodosActionTest() {
    final AtomicBoolean testDone = new AtomicBoolean(false);
    actionBus.register(new Object() {

        @Subscribe
        public void addTodo(ViewAction action) {
            assertThat(action.getType()).isEqualTo(ViewAction.ActionTypes.VIEW_ALL);
            testDone.set(true);
        }
    });
    actionCreator.createViewAllTodosAction();
    while (!testDone.get()) ;
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Subscribe(com.squareup.otto.Subscribe) Test(org.junit.Test)

Example 75 with Subscribe

use of com.squareup.otto.Subscribe in project FluxyAndroidTodo by armueller.

the class ActionCreatorTest method createEditTodoActionTest.

@Test
public void createEditTodoActionTest() {
    final AtomicBoolean testDone = new AtomicBoolean(false);
    actionBus.register(new Object() {

        @Subscribe
        public void addTodo(TodoAction action) {
            assertThat(action.getData().get(TodoAction.DataKeys.ID, -1)).isEqualTo(10);
            assertThat(action.getData().get(TodoAction.DataKeys.DESCRIPTION, "")).isEqualTo("New Description");
            testDone.set(true);
        }
    });
    actionCreator.createEditTodoAction(10, "New Description");
    while (!testDone.get()) ;
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Subscribe(com.squareup.otto.Subscribe) Test(org.junit.Test)

Aggregations

Subscribe (com.squareup.otto.Subscribe)86 Test (org.junit.Test)28 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)27 RawTodoList (com.armueller.fluxytodo.data.RawTodoList)13 ArrayList (java.util.ArrayList)12 TodoAction (com.armueller.fluxytodo.actions.TodoAction)9 VideoData (com.zype.android.webapi.model.video.VideoData)8 DataBundle (com.armueller.fluxytodo.actions.DataBundle)7 File (com.zype.android.webapi.model.player.File)7 Intent (android.content.Intent)6 FilteredTodoList (com.armueller.fluxytodo.data.FilteredTodoList)6 ConsumerFavoriteVideoData (com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData)6 Bundle (android.os.Bundle)5 Video (com.zype.android.Db.Entity.Video)5 Consumer (com.zype.android.webapi.model.consumers.Consumer)5 IOException (java.io.IOException)5 Context (android.content.Context)4 ConnectivityManager (android.net.ConnectivityManager)4 NetworkInfo (android.net.NetworkInfo)4 Dialog (android.app.Dialog)3